## Auto completion for new command document.SUBSCRIPTION_OPTIONS = { "thing": "thread", "subscribed": false, "url": "subscribe", "icon": { "css": "fa fa-envelope-o" } };

TXS - Help
2013-09-17
2013-10-15
• crumbedfish - 2013-09-17

Hello,

I have created a new command in my document that takes as one of its arguments, an existing label in the document. Is there anyway to make TeXstudio do a dropdown list of the available labels when I type in my new command, as it does for \ref commands?

My new command is as follows...

\newcommand{\myref}[2]{
%%% other stuff here
}

The first argument takes an existing label, and the second argument takes a text string. I have looked at packages like cleveref but unfortunately they don't exactly meet my needs...

Thanks.

Last edit: crumbedfish 2013-09-17
• Jan Sundermeyer - 2013-09-17

For now, it is not possible to mix references with text options.
This may change for txs 2.6.4 or 2.6.6

On 17.09.2013 06:26, crumbedfish wrote:

Hello,

I have created a new command in my document that takes as one of its
variables, an existing label in the document. Is there anyway to make
TeXstudio do a dropdown list of the available labels when I type in my
new command, as it does for \ref commands?

My new command is a follows...

\newcommand{\myref}[2]{
%%% other stuff here
}

The first argument takes an existing label, and the second argument
takes a text string. I have looked at packages like cleveref but
unfortunately they don't exactly meet my needs...

Thanks.

Auto completion for new command

Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/texstudio/discussion/907840/

To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/

• Tim Hoffmann - 2013-09-17

As Jan said, multiple-argument commands are not yet supported for completion of citations.

But at least you can make citation checking work by putting\myref{bibid}{text}#c in a user-defined cwl file. See

Also there is a discussion on the extension of the cwl format.

Last edit: Tim Hoffmann 2013-09-17
• crumbedfish - 2013-09-18

Yes, that's exactly what I was looking for. Except instead of citations I wanted a list of labels, so I added the following to a new .cwl file

\myref{key}{text}#r

Thanks for your help, and for a great product!

Cheers!

• FloO - 2013-10-14

Hello community,

my questions is close to the topic. I have created a new command in TXS by

\newcommand{\hnmr}[3]{text #1, text #2, text #3}

When I use my command the autocompletition-function recognizes my command like:

\hnmr{arg1}{arg2}{arg3}

because it is rather complex construction in don't want to remember which argument is which information. So i would like my command to appear in autocpletition like:

\hnmr{freq}{lms}{temp}

For normal commands I am used to edit the .cwl file but this won't work with \newcommand. Can anybody help me to solve this problem?

Btw I have been always redirected to this topic in a rather extended websearch.

• Tim Hoffmann - 2013-10-14

You cannot modify or remove commands defined via newcommand from the completer. However, you could additionally define it in a separate cwl (e.g. user.cwl) by adding \hnmr{freq}{lms}{temp} to the file. Then, add the cwl statically by selecting it at Options -> Completion -> Use following completion files. Now, you'll at least have \hnmr{freq}{lms}{temp} alongside with \hnmr{arg1}{arg2}{arg3} in the completer.

Last edit: Tim Hoffmann 2013-10-14
• FloO - 2013-10-15

Works out perfectly!

Thank you very much :)