I'm planning to store a bunch of user-submitted TeX equations in a database. Problem is, TeX has stuff like \right
... and PHP likes to consider \r as a newline character.
Is there any way to suppress this behaviour? I've tried addslashes
and preg_replace
ing the \r
with \\r
, but neither have worked out.
Edit: An example of stuff I'm expecting to get:
\[\left( {\begin{array}{*{20}{c}}
{{a_{11}}}&{{a_{12}}} \\
{{a_{21}}}&{{a_{22}}}
\end{array}} \right)\]
PHP likes to consider \r as a newline character.
Nope, PHP doesn't.
Just store these equations in a database usual way, there should be no problem.
You just need to follow 2 rules: