Some special characters, e.g. *
, _
and \
have special meaning in Markdown syntax, but these are also commonly used in TeX equations too. This caused some equations, e.g. \alpha^{-1}_{-1} + \beta_{-1}
fails to render properly (see my answer to Math markup, diagrams, etc. — pointers please).
In Math Overflow it is resolved by allowing TeXification in inline code. Since those characters won't be considered special inside backquotes, and we seldom need to write inline code in math, it is perfect for holding TeX equations without changing the backend.
To allow TeXification inside code tag, we just need to edit the config, and remove "code"
from the skipTags:
config.
Of course, this will make the equation have an ugly gray background. I disagree that all <code>
should be made to have a white background, because this makes all code blocks to have a white background on gray background. Instead, I prefer the whiten the <code>
only if it contains TeX equation.
In summary, I propose the following change to math-tex.js:
Find the
var b=...;
line, replace with:var b='MathJax.Hub.Config({imageFont:null,extensions:["tex2jax.js","TeX/AMSmath.js","TeX/noUndefined.js"],jax:["input/TeX","output/HTML-CSS"],TeX:{noUndefined:{attributes:{mathcolor:"red",mathbackground:"#FFEEEE",mathsize:"90%"}}},tex2jax:{skipTags:["script","noscript","style","textarea","pre"],ignoreClass:"tex2jax_ignore|dno"},});MathJax.Hub.Register.StartupHook("End",function(){$("code > .MathJax").parent().css({"background-color":"transparent"})});MathJax.Hub.Startup.onload();';
This will allow TeXification in <code>
tag (at the same time, solve the editing comment problem).
$
signs. $\endgroup$$
everywhere? It doesn't seem to matter much... $\endgroup$$
sign as its intended purpose (indicating money), have you? $\endgroup$