# Colours in syntax highlighting

As mentioned in the comments to this answer on meta, Martin's improved syntax highlighting is installed now. Somehow it happened that not the most recent version got installed (or it didn't get installed as is). The effect is that \def, \newcommand and friends get a colour doesn't fit into our design.

Thus my question: Do we want an extra colour for those commands at all? (I don't.) If yes, maybe Jin can have a look what colour would fit.

Another thing: $ and & also get coloured (which I like), but also this colour is slightly obtrusive in my opinion. Thoughts? • Ok, now thats wierd. Have a look at this post. Some macros which start with \@... are highlighted correctly (i.e. fully), but with others only the \@. Also in the first mentioning of \mytitle it is correct, but the second one only the \my is highlighted!! I really have to look into that. – Martin Scharrer Feb 15 '11 at 9:53 • @Martin: weird indeed. But I can't say anything about it since I don't understand how your script works. – Hendrik Vogt Feb 15 '11 at 10:00 • Ok, got it. That post has some special right-to-left unicode markers in it which confuses the syntax highlighting code. Mystery solved. – Martin Scharrer Feb 15 '11 at 11:02 ## 2 Answers In the latest version posted the syntax highlighted was disabled by commenting the PR_DECLARATION line out. Maybe the comments have been removed. I got a little carried away when I added it. I agree, it's not really needed. The colors are defined completely separate from the highlighter plugin using CSS. The purple color for \newcommand and friends is really unpleasant. The blue colors of the $ and &, but also for { }, ( ) (PR_PUNCTUATION) should really be changed to something more fitting to the page. I think brown or red-ish colors are more suitable.

• I'd say: Let wait a day or two for other opinions and then ask Jin if he can have a look for a good colour. – Hendrik Vogt Feb 12 '11 at 14:18
• I'm watching the discussion here for a general consensus before updating the CSS. I will bring this up with Jin as well on Monday. – Geoff Dalgas Feb 13 '11 at 6:20
• @Geoff: Is there any new development? What did Jin say? – Hendrik Vogt Mar 1 '11 at 16:35
• @Geoff: Just another ping ... – Hendrik Vogt Mar 22 '11 at 15:29

There are also three related issues I like to list here again for clarity:

1. The units for dimensions are not properly separated, e.g. the 1in in \csname#1input\endcsname is highlighted as a number. I saw this in one of Herberts posts. I think I can fix this easily in the related regex.

2. The syntax highlighting in the edit preview is still not working correctly, i.e. set to default, which renders # as a comment character. The fix for this requires a minor change in the HTML code of the site.

3. There is no syntax highlighting on meta itself.

We could fix these issues (at least 1&2) in one go with the colors in order to bother Geoff Dalgas♦, or whoever is in charge for that, only once.

• @Martin: wild guess on the fist point: it is missing a word-boundary at the end (\b). In case you might be interested, I had a stab at this earlier: meta.tex.stackexchange.com/questions/10/syntax-highlighting/… – morbusg Feb 12 '11 at 18:57
• Thanks @morbusg, I was planning to add a \b. Like I said, I just added a fix at the existing one. I have no idea why your version wasn't used in the first place. – Martin Scharrer Feb 12 '11 at 18:59
• Well, like I said in the earlier anwer, I'm no regex-guru. In hindsight, for instance, my first LITERAL definition should've been a KEYWORD. I'm glad it all happened though, one way or another :-) – morbusg Feb 12 '11 at 19:30
• @Martin: It seems that #2 just got implemented. I'm not sure if I want #3. – Hendrik Vogt Feb 13 '11 at 9:26
• @Hendrik: No, #2 seems to be still not working. It works with the Greacemonkey script I provided, maybe you have this activated? – Martin Scharrer Feb 15 '11 at 9:55
• @Martin: When I wrote that comment, it seemed to be working, and I didn't even have your script installed on that computer. Now it's not working, indeed. – Hendrik Vogt Feb 15 '11 at 9:59