06.29.05
LatexRender and ampersands problems
I’ve been using LatexRender for a while, and I must say it works wonderfully. I had hit a slight snag, which I figured out with the help of Sameer (well ok, that means he did all the work). It had to do with the fact that, by default, wordpress changes all ampersands to their escape codes, namely &038;. This is quite irritating, since if you are to have any matrices in the LaTeX code, it is bound to involve lots of ampersands to separate the columns, so you end up with lots of &038;’s floating around, quite irritating. The solution turns out to be fairly simple, and already implemented in LatexRender, albeit commented out, and it simply amounts to replacing all those &038;’s with &’s. What you have to do is locate your latex.php file, which in my case was in a folder called latexrender, and uncomment the lines around line 60, that have text like:
// $latex_formula = str_replace("&","&",$latex_formula);
// $latex_formula = str_replace("&","&",$latex_formula);
and also change #38 to #038, resulting in:
$latex_formula = str_replace("&","&",$latex_formula);
$latex_formula = str_replace("&","&",$latex_formula);
It should now work fine, once you remove the cached images located usually in the latexrender/pictures directory.
Later