Click here to Skip to main content
15,851,701 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm in the process of converting latex to mathml in php.Texmath is the command line tool through which the conversion process can be done.

Latex file:
\mathbf{f} = (f_{1},
f_{2})^{\prime}


test.php:
PHP
shell_exec('echo "password" | sudo -S /root/.cabal/bin/texmath latexfile > outputfile');

If I run this php file thorugh command line,it generates the desired output file which is below
command line script:
PHP
php test.php

XML
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
     <mrow>
       <mstyle mathvariant="bold">
         <mi>𝐟</mi>
       </mstyle>
       <mo>=</mo>
       <mo stretchy="false" form="prefix">(</mo>
       <msub>
         <mi>f</mi>
         <mn>1</mn>
       </msub>
       <mo>,</mo>
       <msub>
         <mi>f</mi>
         <mn>2</mn>
       </msub>
       <msup>
         <mo stretchy="false" form="postfix">)</mo>
         <mo></mo>
       </msup>
     </mrow>
   </math>

When I run this php file through the browser am getting the output file like
XML
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
      <mrow>
        <mstyle mathvariant="bold">
          <mi>

It ignores all the mathtype characters. Why is it gives desired output only through the command line not through the browser. When I open these two files in the editor it displays 'UTF-8'. Is this is character encoding issue? How to solve this.

Additional note: If I run php file through local host it gives desired result as the command line php execution does. The problem only with shared web server.
Posted
Comments
John C Rayan 27-Feb-15 5:31am    
can you get the source from your browser using view source. What browser are you using.
Vidhya Raju 1-Mar-15 23:41pm    
It doesn't display anything in the browser. Just this code creates a file which contains special characters

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900