Yes, I saw this question about adding LaTeX syntax highlighting to the general purpose system on Stack Overflow proper. However, there are now at least three sites (MathOverflow, Mathematics, and TeX), where LaTeX is probably going to be the only language inside all those code blocks. So this is a request for a single-language syntax highlighting system just for LaTeX to be used on those sites.

Shreevatsar posted on meta.tex.stackexchange:
A toy example of something that ought to be highlighted correctly:

  \item This is # not a comment
  \item This is % a comment

A good syntax highlighter would recognize which lines are comments, and also probably do something with 'begin', 'end' and 'item' (as the LaTeX Wikibook does).

(It seems a weaker version of this has been asked before as Syntax Highlighting Hints, and there's even a somewhat simple hack that is not implemented. Irrespective of all that history, consider this another request for TeX-specific syntax highlighting on this website, not necessarily using any of the more general solutions.)

closed as off topic by Jeff Atwood Jul 27 '10 at 8:43

Questions on Meta Stack Exchange are expected to relate to the software that powers the Stack Exchange network within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Note that Mathoverflow, at least, doesn't often have occasion for syntax-highlighting LaTeX code: instead the requirement is to typeset mathematics using TeX-style input, which is handled by jsmath. It's mainly tex.stackexchange, as well Stack Overflow and SuperUser, that need syntax highlighting for LaTeX. Despite all the history, I remain foolishly optimistic that the overlords here will listen to requests and implement it. :-) – ShreevatsaR Jul 27 '10 at 2:02
  • Original question on meta.tex.stackexchange.com: meta.tex.stackexchange.com/questions/10/syntax-highlighting – ShreevatsaR Jul 27 '10 at 2:04
  • @ShreevatsaR: You are right that the non-tex sites will probably have little reason to use TeX in code blocks. What I meant was that if these sites ever do use code, there is a very high chance that it will be in LaTeX. If people think it detracts from the point, I am open to changing it. – Larry Wang Jul 27 '10 at 2:19
  • This should be opened on the per-site meta for discussion, not here. See meta.stackexchange.com/questions/58397/… – Jeff Atwood Jul 27 '10 at 8:43
  • 2
    @Jeff Atwood: I didn't ask this question here and wouldn't have thought of it, but this is really a cross-site request for several Stack Exchange sites, not just one. (But it's a variant of this request.) – ShreevatsaR Jul 27 '10 at 12:48
  • @Jeff: What if I rephrased the question to ask something more general: Can stackexchange sites have language-specific syntax highlighting if they expect only one language to be used? – Larry Wang Jul 27 '10 at 16:46

It would be ridiculous if lex syntax highlighting wasn't supported in a website whose only objective is to ask lex questions.

  • but then, it’s ridiculous that syntax highlighting still doesn’t work for all common languages on a site whose only objective is to ask general-purpose programming questions (Stack Overflow). – Konrad Rudolph Jul 27 '10 at 11:44
  • @Konrad: this is for technical reasons; it's impossible to correctly detect the programming language if you want to support several. – Thomas Bonini Jul 27 '10 at 13:12
  • is asking for "lex" syntax highlighting on a question about "TeX" syntax highlighting intentional? I mean, it seem to point out the issue that the team faces in this. The current highlighting engine is heuristic and simply takes advantage of the similarity of many popular languages. But in the Stack Exchange era, every site will, reasonable, want correct highlighting for their language. – dmckee Jul 27 '10 at 14:51
  • 2
    No, it’s not for technical reasons, it’s purely ideological. Prettify does support explicitly specifying the language. There’s no (technical) reason not to allow this on Stack Overflow. The Stack Overflow Markdown implementation simply filters the relevant attribute. – Konrad Rudolph Jul 27 '10 at 19:28

Not the answer you're looking for? Browse other questions tagged .