Did the meaning of the character sequence
\f in PHP change overnight? I just had a bizarre error in my LaTeX rendering plugin, which I ended up fixing by adding a whole bunch of extra backslashes. LaTeXrender works by generating a LaTeX document from a formula in a webpage and then passing that document through the LaTeX interpreter, converting the output into an image which is placed in the webpage. This means that the peculiarities of LaTeX and of PHP must both be respected, and because both languages use the backslash character for special purposes, extra backslashes appear when those purposes collide.
\n in PHP (and in C) stands for a newline character (yes, we are still slave to the teletype). So, if you want your PHP program to output a character string containing the LaTeX command
\newline, you have to write
\\newline. The first backslash “escapes” the second.
Suddenly, LaTeXrender started spewing out garbage: big blocks of image with bits of LaTeX commands inside, wrapped around a formula in the middle. Something must have started going wrong with the text being passed to LaTeX. How did I, the seasoned LaTeX guru and MIT graduate, solve this conundrum?
I threw backslashes at the problem until it went away.
No, seriously: all LaTeX commands starting with
\formulabox or whatever, needed an extra backslash. I changed every instance of
\f in the PHP source code to
\\f, and now the plugin works again. Why this is necessary today but wasn’t necessary yesterday. . . I leave that as an exercise for the interested reader.
This is why I don’t have a nice post about the Dirac Equation for you today.