#1033 Formulas in TODO commands break highlighting

Jan Rieke

Formulas within TODO commands that contain {}s cause the remainder of the document to be highlighed in green (i.e., the parser does not detect the end of the TODO command any more).

Minimal example: \todo{$a^{2x}$}


  • Tim Hoffmann

    Tim Hoffmann - 2014-07-05

    \Highlighting \todo-like commands is actually quite a hack due to limitations in the parser. Given the current framework we cannot make it behave correct in all possible cases. See https://sourceforge.net/p/texstudio/feature-requests/739/#dd65 for details.

    In your case, you can apply the following alternatives as a workaround:

    A) Remove highlighting of \todo-like commands. For this, you have to modify the language definition (see manual). Essentially, copy the original tex.qnfa and delete the context for the \todo commands.

    B) Keep the highlighting and just fix the leaking of the math context. If the highlighter got mixed up with a math context, you can add the comment %$ to the end of a line to force closing a possibly open math context; i.e.

    \todo{$a^{2x}$} leaked math context %$
    back to normal here.
    • doncherry

      doncherry - 2014-10-03

      Does the same limitation apply to the highlighting of

      \todo{Foo \texttt{\textbackslash{}bar} baz}?

      faulty highlighting

      • Tim Hoffmann

        Tim Hoffmann - 2014-10-06


  • Tim Hoffmann

    Tim Hoffmann - 2014-07-05
    • status: open --> wont-fix
    • Group: -->
  • Benito van der Zander

    • status: wont-fix --> fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks