Menu

Some questions regarding bad syntax highlighting

2015-11-10
2015-11-12
  • hereforthefish

    hereforthefish - 2015-11-10

    Hi there,

    I'm using TeXstudio 2.10.4 with MiKTeX 2.9 on Windows 7 (64 bit). I really love TeXstudio and it's features, however, I'm having a few issues with the automatic highlighting of bad syntax:

    • I'm using the siunitx package, and some unit commands are not recognized while the majority are. For example in si{\milli\litre} the "milli" is recognized while "litre" isn't (and it's not a matter of spelling, both "liter" and "litre" are recognized by siunitx, the former giving the output "l", the latter "L"). I've checked the siunitx.cwl file, both "milli" and "litre" are in there (and the file is activated in TeXstudio's options).

    • A similar thing happens with the textgreek package - here however, the corresponding .cwl file didn't actually include the commands \textalpha, \textbeta etc., adding them manually solved the problem. I just find it strange that the commands aren't in the file in the first place (but I gues that's a package problem, not a TeXstudio problem).

    • I remember reading somewhere that custom commands defined with \newcommand in the preamble are automatically added to the auto completion list. This doesn't happen. However, I can't find the source where I read this, so maybe I'm just wrong here.

    • When using a non-counted longtable environment with \begin{longtable*}, the \beginis now longer recognized and consequentially column separators (&) are suddenly marked as bad syntax because TeXstudio thinks they're used outside a table environment.

    None of this is actually a major problem, but it does make bugfixing a bit harder sometimes.

     
  • Tim Hoffmann

    Tim Hoffmann - 2015-11-10
    • \\litre and \\liter were not included in the siunitx.cwl which we provide along with TXS -> fixed.
    • Unknown commands in general: see FAQ: How does TXS know about valid commands.
    • \\newcommand: This works as long as TXS has loaded the preamble. See also the link above.
    • The package longtable does not provide an environment longtable*. Where did you get it from?
     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2015-11-10

    I am not sure what cwl you are looking at, but in the built-in cwl, \litre /\liter was missing.
    I have added it.

    textgreek is not provided by txs, but it is scanned. However some package are tricky so that the result is incomplete.

    \newcommand adds new commands to completion (typical/all) and here it works fine.
    If it does not work, please post an example tex.

    longtable documentation does not say anything about a longtable* env. And compiling such an construct fails. So the stated error is correct.

     
  • hereforthefish

    hereforthefish - 2015-11-12

    Thank you guys for the quick response!

    I think the highlighting of new commands was indeed the result of a not yet loaded preamble, mea culpa.

    The longtable* idea comes from the guys over at stackexchange, namely these two threads:

    http://tex.stackexchange.com/questions/32553/longtable-caption-without-incrementing-table

    http://tex.stackexchange.com/questions/33395/longtable-caption-numbering

    Admittedly, it wasn't exactly the top-voted answer in the first thread, but I was lazy and just wanted the longtables to disappear from the list of tables (which worked, by the way). I'll guess I'll try the \addtocounter{table}{-1} option then.

     

Anonymous
Anonymous

Add attachments
Cancel