1

I've read quite a few questions and answers on this web site but none helps me to resolve my problem. I am using \ref and \eqref commands most often. After installing and re-installing the latest version of TeXstudio (2.10.0, 5.5.0), in some files the command \ref offers a list of available labels, but in some it gives an empty list although the file itself contains plenty of labels. At the same time, \eqref does not work at all. I would be grateful if somebody could help! Thanks!

  • 1
    Welcome to TeX.SX! I don't use such editors, but I could imagine that TeXStudio needs an .aux file to get the labels from? –  Sep 17 '15 at 08:55
  • TeXstudio rolled out an update (2.10.2) yesterday, in the changelog it says - fix detection of \ref commands – Francis Sep 17 '15 at 09:26
  • @Christian -- you are right, TeXstudio does need .aux files. – Alex Sobolev Sep 17 '15 at 12:26
  • @Francis, thanks. Downloaded and tried. \ref or \eqref did not work until TeXstudio completely re-installed. Now \ref works, but \eqref does not. – Alex Sobolev Sep 17 '15 at 12:32
  • @AlexSobolev: I am using TeXstudio 2.10.2 and have no problem with either \ref or \eqref. Have you tried completely uninstalling TeXstudio and removing all user profile (e.g. in AppData for Windows)? – Francis Sep 18 '15 at 17:13
  • @Francis, thanks for the idea. I have tried to uninstall and re-install TeXstudio deleting all files associated. Last time I did this last night, but today I am having the same problem. Our sysadmin told me that this had been reported by a few other users, and it seems to be a genuine bug in the programme. – Alex Sobolev Sep 19 '15 at 13:42
  • @AlexSobolev: Sorry to hear that, hope they will fix this soon – Francis Sep 20 '15 at 01:34

3 Answers3

3

When \ref offers the list of labels but \eqref does not, add \eqref{key}#r to your .cwl file. Then save it, close TeXstudio and again open TeXstudio.

I found it here and it solved the problem for me. Unfortunately, I don't have a link to an explanation of key and #r or of .cwl's in general.

Sigur
  • 37,330
Convexity
  • 342
1

This seems to be a known bug in TeXstudio 2.10.X that is still not fixed in the current release 2.10.8; but there is a workaround, which worked for me and does not cause problems as far as I can tell:

For now, txs generates cwl files for syntax checking.
Please make sure that those files don't contain "\ref#S" or  "\label#S".
Just delete those lines and it should work again.

See also here on where to find the cwl files.

Sebastian
  • 263
  • It works here. That ( http://sourceforge.net/p/texstudio/bugs/1480/ ) minimal example with bug works fine here. I'm using TXS 2.10.8 – Sigur Jan 26 '16 at 16:38
  • 1
    I guess it depends on which cwl files you activate by default (under setting - completion) – Sebastian Jan 26 '16 at 20:44
  • I had activated a lot of cwl files by default (by checking them in the config dialog), so also the minimal example did not work for me. I did not erase my configuration before updating, which might solve the issue, as well. In case the OP has similar configuration than I have/had, he might profit from the workaround. – Sebastian Jan 27 '16 at 10:59
0

As of version version 2.10.8 the default cwl files are built in and cannot by modified directly

For newer versions TXS searches for cwl files in three different locations:

  1. settings directory/completion/user
  2. builtin cwls
  3. settings directory/completion/autogenerated

you may have a look at the source code of the buitlin cwls. In OSX, create a custom.cwl under /Users/username/.config/texstudio/completion/user/ with the following:

\eqref{label}#r
# \FG{label}#r

If like me you have defined custom commands to consistently label figures, tables, sections (e.g. \newcommand{\FG}[1]{Fig.~\ref{#1}}), adding them to the custom.cwl makes the completion work for them too.

Last, you need to restart your TexStudio and enabled custom.cwl in the TexStudio settings: Preferences -> Completion