Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Auto completion for new command

TXS - Help
2013-09-17
2013-10-15
  • crumbedfish
    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
    • 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
      https://sourceforge.net/p/texstudio/discussion/907840/thread/3a57ff1a/?limit=25#7c33


      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/

       
  • FloO
    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
    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
      FloO
      2013-10-15

      Works out perfectly!

      Thank you very much :)