# LaTeX markup and dollar signs in code

Can someone explain to me, what happens in this question on mine? I wanted to write something like

$KernelID and $ProcessID

but in the question it seems like the LaTeX markup got confused:

Is there a way to prevent this?

• Very annoying. I had to cheat... – J. M.'s discontentment Jun 19 '12 at 6:55
• It has been like this for a while now, I think it's a bug in how MathJax and MarkDown are separated. I added the bug tag, this is something worth looking at by SE staff. See here and the subsequent comments too. – Szabolcs Jun 19 '12 at 7:23
• Thanks, I've been meaning to post about that. – rcollyer Jun 19 '12 at 14:00

I have checked in a fix for this; it will work as expected in the next build of the site.

The separation of Markdown and LaTeX wasn't taking code spans into account, so when seeing

$foo and $bar


it prevented Markdown rendering in the part between the two dollar signs. The Markdown renderer thus saw

[something I'm not touching]bar,


turning the whole thing into a code span, and eventually we ended up with

<code>$foo and $bar</code>

• Thank you very much! – halirutan Jun 19 '12 at 11:55