TeX - LaTeX Asked on July 19, 2021
I defined this macro:
newcommandafigure[4][]{%
begin{figure}%
centering%
includegraphics[#1]{#2}%
caption{#3}%
label{#4}%
end{figure}%
}
TeXstudio has an auto-complete feature for labels, which is quite handy. However, when I use the above macro, the label I give isn’t recognised by the editor, and so it does not appear on the list of auto-completable (sic) labels. Is there a way of telling TeXstudio to take the fourth argument there and consider it as being given inside a label
macro? Thanks!
TeXstudio uses .cwl
files for auto-completion, which are usually auto-generated, but you can also create your own.
According to the TeXstudio manual, they are stored in %appdata%texstudiocompletionuser
or .config/texstudio/completion/user
by default, depending on your OS. If you have made a custom installation, search for completion
in your TeXstudio folder.
Then, all you have to do is to create a file called something like mycmds.cwl
in that folder and write the two lines
afigure{imagefile}{caption%text}{label%labeldef}#g
afigure[keyvals]{imagefile}{caption%text}{label%labeldef}#g
Then restart TeXstudio, and the completion should work the way you want it to:
Correct answer by schoekling on July 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP