0

From Texsudio manual on autocompletion files:

"The classifiers specifying the meaning of arguments (like c or i) always apply to the first non-optional parameter. This is a current limitation of the cwl format and the LaTeX parser in TXS. For example \ref{label}#r and \ref[option]{label}#r will work as expected, but \ref{arg}{label}#r will interpret arg as reference. We recommend not to specify any class in such a case."

Does it mean that there is no way to use the second argument of command as a label recognized by texstudio or one can "skip class" and use the next argument?

for example:

\newcommand{\dplot}[3]{
\begin{figure}
    \centering
    \subfigure[]{\includegraphics[width=0.49\columnwidth]{Fig/#1}
        \label{fig:#1}}
    \hspace*{-0.01\columnwidth}
    \subfigure[]{\includegraphics[width=0.49\columnwidth]{Fig/#2}
        \label{fig:#2}}
    \vspace*{-0.01\columnwidth}
    \caption{#3}
    \label{fig:#1:#2}\label{fig:#1_Full}
\end{figure}
}

I can use cwl file to recognize 1st argument by adding:

\dplot{label}#l

Could I do some skipping like:

\dplot{}{label}#l

in order to use the second argument as a label?

1 Answer 1

1

The statement you mentioned from the manual is outdated.

If you use the #l qualifier, you can define an arbitray argument as label, but it's name has to be label.

\dplot{arg}{label}#l

If you want to use a different name or multiple labels, you can use the inline definition with labeldef.

\dplot{label1%labeldef}{label2%labeldef}

Note: Your example will still not work, because the names labels and references have to be identical. Otherwise TeXstudio cannot match them. You cannot \dplot{mylabel} and \ref{fig:mylabel}. See also autocomplete with labels defined by user commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .