Syntax highlighting \DeclareSIUnit

TXS - Help
2012-04-03
2012-10-17
  • t.schreiter
    t.schreiter
    2012-04-03

    Hi,

    To show numbers and units, I define my own units using the siunitx package. To
    define the shortcut \kmh for km/h, the command \DeclareSIUnit {\kmh}
    {\kilo\metre\per\hour} is used.

    However, the syntax highlighting of TXS does not recognize the new command
    \kmh as such, since it has not been declared by \newcommand.

    Is there a way to let TXS know that units defined by \DeclareSIUnit are valid
    commands?

    /Thomas

     
  • Tim Hoffmann
    Tim Hoffmann
    2012-04-03

    That is currently not possible (except if you change the source code).

    As a workaround you could create a completion file myunits.cwl and put it in
    the application data directory (the directory which contains texstudio.ini).
    For your case, just writing your units one per line is sufficient. A complete
    description of the cwl format is given in the texstudio help.

    Restart TXS and enable your file at Config -> Completion -> Use following
    completion files