TeXstudio's autocomplete suggested \microfarad
as a command so I attempted to use it but received an "undefined control sequence" error. There are easy workarounds (\micro\farad
and \micro\F
), but why does autocomplete think \microfarad
exists if it apparently doesn't? I had never used \microfarad
before because I didn't know it "existed" until I started typing in \micro\F
and noticed the suggestion.
This appears to be the case for other commands like \microampere
, \microgram
, etc. I noticed the problem with \microfarad
because there are shorter commands for the other units (\uA
, \ug
, etc.) but \uF
doesn't exist either.
Why does TeXstudio's autocomplete suggest these non-existent commands?
I've found this problem on two separate Windows 7 machines, and strangely I cannot find an siunitx.cwl file on either machine.
MWE:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI{1}{\microfarad}\\ % undefined control sequence
\SI{1}{\micro\farad}\\ % works
\SI{1}{\micro\F} % works
\end{document}
Best Answer
I think that this is a bug of TeXstudio. The problem is that TeXstudio has auto-completion support for certain commands hard-coded in, most likely for performance reasons. This can be easily checked by looking at the
texstudio.exe
in a text editor and searching for\microampere
(line 68436 in version 2.9.4).So I would say this is TeXstudio's bug and you should submit it in their bugzilla. I think this is a case for many other commands, so you could also suggest general cleanup of the hard-coded lists of commands.
Edit: I checked the source of TeXstudio 2.9.4 and really, the file
completion/siunitx.cwl
contains\microfarad
, etc. These files must then be compiled into the binary which is distributed.