The current TeXification function is too aggressive. The current behavior is that,
- any text between two dollar signs in a single element will be formatted as a TeX formula.
- this excludes any elements in
However, this simplistic matching algorithm
causes TeXification in unsuitable places, e.g. inside code blocks
while it's rare to write code here, it is still usable for ASCII art.
makes it impossible to use a raw dollar sign. Not even
$works. In MathOverflow we can escape a dollar sign by prefixing a backslash (
＼＄), but even this won't work here.
To see the mess it caused, see https://math.meta.stackexchange.com/questions/398#398.
Problem 1 can be fixed simply by also excluding the
<pre> element in Behavior 2, just like MathOverflow. To solve problem 2, the whole
goGoGadgetMath() function has to be rewritten, or just use jsMath/MathJax.