## #1033 Formulas in TODO commands break highlighting

None
fixed
nobody
None
1
2014-07-06
2014-07-03
Jan Rieke
No

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}\$}

## Discussion

• 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
2014-10-03

Does the same limitation apply to the highlighting of

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

• Tim Hoffmann
2014-10-06

Yes.

• Tim Hoffmann
2014-07-05

• status: open --> wont-fix
• Group: -->

• status: wont-fix --> fixed