I just saw this at Herbert answer to this question:
if a code block contains \\
directly followed by a text then the syntax highlighting marks it as macro.
This is quite irritating and should be fixed. Most likely the regular expression for macros misses a look-behind instruction.
Another example where the regular expression should be improved, added by Hendrik: In this answer it is probably hardly avoidable that \MikTeX
is interpreted as a control sequence, but at least the 2.9
shouldn't be part of the control sequence. See also this question, where it looks as if \ifnum0
was the control sequence. Or is this intentional?
Proposed Solution
I updated the JavaScript syntax file for LaTeX (New Version) which now
highlights word with starts with \
and are followed by a-z, A-Z and @
OR followed by any other single character (e.g. \\
, \_
) as macros.
Here an example result (as slightly magnified image):
I would ask people to vote on this version, so that it can be installed on tex.sx and maybe also on meta. See my answer below for further information and the discussion on the previous versions of the above file.