Syntax highlighting \DeclareSIUnit

TXS - Help
  • t.schreiter


    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


  • Tim Hoffmann
    Tim Hoffmann

    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