## #934 Since 2.7.0: syntax color and \usepackage

None
fixed
nobody
None
1
2014-03-26
2014-03-19
Mathieu2L
No

Hi,

This appears to be a bug that happens since the last version 2.7.0 (unless it was deactivated on purpose, but that would be a shame):

After a compilation, the name of the package inside a \usepackage{} is not colored in green and if the mouse hovers the name, it says "package not found".
This was not the case with TXS 2.6.6 (the name was colored in green when recognized after a compilation).

TXS 2.7.0 under win XP

## Discussion

• Carlos
2014-03-19

I had a similar problem but with \label and \ref. Bug #933.
I solved it by removing the texstudio.ini and then configuring all preferences again.
You can do a backup of [format] part in texstudio.ini in order to avoid losing your highlight syntax (if you changed it).
The problem is related to the file being created by 2.6.6 version and then updated by 2.7.0. The latest version mess it all.

One quick suggestion: just rename your texstudio.ini to something else, start texstudio and check if your problem is solved. Then you can proceed to a new texstudio.ini creation. Otherwise, forget what I said above.

Last edit: Carlos 2014-03-19

• Mathieu2L
2014-03-19

@Carlos: indeed, our problems seem related (I didn't realize it when reading your bug report). The bug no longer happens if I rename my texstudio.ini and then restart TXS (I'd say it works even better because I don't need to run a compilation to have highlight syntax on my packages). Thanks for the suggestion!

However I think I did a lot of customization in my .ini so I'm not yet ready to restart from scratch all my config ;-)

• Carlos
2014-03-20

You can do what I did. I pasted all my changes in the new texstudio.ini...
Well, almost all... :)
It is annoying, but works.
Regards.

• sirixlancelot
2014-03-20

The same is true for broken access to package documentation. Removing the ini file fixed this. (before, it said "no documentation available").

• Tim Hoffmann
2014-03-20

The behavior of package highlighting changed slightly in version 2.7.0. We now query the LaTeX installation which packages are installed. This is performed at startup. The first run may take some time (approx. a minute depending on your system). Until it's completed the packages are not highlighted (ok, the 'Package not found' tooltip may be a bit misleading and 'Package background scan in progress' would be better). When the run is complete, highlighting is automatically added. Also, we store the information so that it's directly available at the next start (this is in packageCache.dat next to texstudio.ini). If you terminate TXS before the initial package scan is complete, package scanning will have to start over again from the beginning on the next program start.

This should have nothing to do with ini configuration settings. It's probably a coincidence that you waited long enough for the scan to complete after changing your ini. It should also work with your original ini.

• Mathieu2L
2014-03-21

I agree with @sirixlancelot on the fact that it is not only a problem of "how long TXS is open". I have two cases:

1. First computer (windows XP with MiKTeX) with the upgrade from 2.6.6 to 2.7: TXS stayed open several hours and what I described in the bug report remains. I add that: I can open the package documentation and the file packageCache.dat is created but empty (except fot the first line).
2. Another computer (Win 7 with TeXLive) where 2.6.6 was completely unistalled (including config/custom files) before installing 2.7. Then it works as you (@Tim) described.

(So the first case is consistent with the EDIT of @sirixlancelot 11h ago and there is no bug in the second one.)

• Tim Hoffmann
2014-03-22

Options -> Editor -> Inline Checking -> Package

• Mathieu2L
2014-03-23

Yes, the checkbox is activated :-(

• Tim Hoffmann
2014-03-23

I add that: I can open the package documentation and the file packageCache.dat is created but empty (except fot the first line).

Sorry, I overread this. I assume the first line is just the comment (% detected .sty and .cls filenames). It seems, that the whole scanning process does not work in your case. This is how it should work: we query the miktex package manager (mpm.exe), which is in your Miktex bin folder. To find it, we infere the path from the pdflatex command set in the options.

1. In which folder is miktex installed?
2. What is the pdflatex command line in the options?
3. what is the result of where pdflatex displayed when you click Help -> Check Latex Installation?

• Mathieu2L
2014-03-23

You're right about the first line being the comment.

1. MiKTeX is installed in C:\Program Files\MiKTeX 2.9 (default installation directory). And mpm.exe is in \MiKTeX 2.9\miktex\bin.
2. You do mean the options of TXS in Options -> Commands? If yes, I have
pdflatex -synctex=1 -interaction=nonstopmode %.tex
3. The line is empty after the where pdflatex. More precisely, the first four lines are as follow:
where pdflatex:

PDFLATEX: pdflatex -version
MiKTeX-pdfTeX 2.9.4902 (1.40.14) (MiKTeX 2.9)

• sirixlancelot
2014-03-20

Don't want to derail this thread too much, but at least in my case I can deny this.

Texstudio is currently running continuously, so there shouldn't be an issue with interruption of the indexing process. In fact, it showed "Package present" for me, but as I said, was not able to find the documentation for any package.

Shutting down TXS and removing the ini file resolved this.
Unfortunately, I can not say for sure whether a simple restart would have been sufficient because I am not sure if/how often I restarted TXS since upgrading to 2.7 three days ago.

• Tim Hoffmann
2014-03-20

If you have "Package present" then the package scanning itself works fine and your documentation issue a different thing. So please open up a separate bug report for it and let's discuss it there. For your issue the following additional information may be relevant:

• Which OS are you using?
• Which LaTeX distribution?
• Do you get the documentation when you use "Open package documentation" in the context menu on the package name in the editor?
• Is the package name listed in Help -> Package Help?

• sirixlancelot
2014-03-20

Sorry, I cannot reproduce this anymore, since after removing/resetting the ini file it worked fine (but as I said, maybe it was just another restart of TXS). I only commented on this ticket since the solution worked for my problem as well.

EDIT: I just restored the old ini file and retried. The packages in \usepackage are not highlighted, but documentation access works fine. So at least for the latter, it seems the restart was sufficient.

Last edit: sirixlancelot 2014-03-20

• Tim Hoffmann
2014-03-22

@sirixlancelot: You have the inline package checking turned off in your settings of the 2.6.6 version (Options -> Editor -> Inline Checking -> Package).

• sirixlancelot
2014-03-22

• Tim Hoffmann
2014-03-23

The line is empty after the where pdflatex.
That may indeed the problem. Though, I currently don't understand how it can be empty and still the miktex pdflatex is found.

If you hard code the path
C:\Program Files\MiKTeX 2.9\miktex\bin\pdflatex for the in the options:

1. Does something show up for where pdflatex?
2. Does the package scanning work? Remember that it may take a minute or so to complete. Afterwards the packageCache.dat should be updated (you can check the timestamp).

• Mathieu2L
2014-03-23

Once the path has been hard coded and TXS restarted:

1. Nothing changes for where pdflatex
2. However, the package scanning works (the packageCache.dat file is no longer empty an the syntax highlighting is ok). :-)

Note: I've also tried the following: renaming the texstudio.ini and restarting TXS; then where pdflatex is still empty; but, as previously mentionned, packageChange.dat is created almost instantly and syntax highlighting works (without hard coding the pdflatex path).

• Tim Hoffmann
2014-03-23

I just looked into the source code again. We are not using the pdflatex command but the latex command in the options to infere the bin path of miktex. Are the settings for it in the default-constructed and in your renamed ini the same?

• Mathieu2L
2014-03-25

(Sorry, I thought I posted it earlier.)
Well... I'm quite puzzled because, in short, I cannot reproduce the solution steps I did on Sunday.

Here what happened: I noticed there was a miktexPackageNames.dat still containing information so I deleted it before answering your question; then I retried the process: however, I am now unable to regain the syntax highlight... !?!

I have no explanation to that behavior... Maybe I messed things up by changing the .ini and the packageCache.dat. Perhaps the best thing to do is sending you my .ini by email?

• Tim Hoffmann
2014-03-25

Ok, I did some more checks here. It seems that paths containing whitespace are not correctly handled in all cases. What definitively works for me is adding
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin to the PATH and only specifying latex.exe and pdflatex.exe in the respective commands. Then where pdflatex should show an answer and after a restart, the package scanner should work correctly and produce both miktexPackageNames.dat and packageCache.dat (maybe with the first-time startup delay). Please report back, if this helped. If not, you can send the ini to me (thoffmann@texstudio.org).

• Tim Hoffmann
2014-03-26

• status: open --> fixed
• Group: -->