Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

LaTeX Parser/Converter

  1. Nov 11, 2007 #1
    Long time lurker, first time poster, and I'm embarrassed that my first post is a request. I'm in the process of creating a website which will require being able to post mathematical formulae by the public, and the best solution I've thought of for this is the same LaTeX solution that this forum uses, seeing as it is probably the most user-friendly that I have seen with the LaTeX Reference box. The website doesn't use VBulletin, but it will use a similar, custom made solution. So, I was just wondering if anybody could point me towards the right direction towards either an implementation-ready package that's already been made or how to make a parser myself. I do know PHP and HTML, and I'm learning Java (not JavaScript)
  2. jcsd
  3. Nov 14, 2007 #2


    User Avatar
    Science Advisor

    There are LaTeX packages available for Windows and Linux, in these packages you should find executables for converting a LaTeX doc into a .dvi (print file) and for converting a .dvi to .png, .pdf or ps.

    In PHP you can call executables using the exec() function, so you can save the LaTeX document to a file, call the latex executable to generate the dvi, and then call png/pdf/ps converters to generate the desired file type.

    This a multi-step process but is actually not that bad in terms of performance. There are some Perl/CGI alternatives (MimeTeX for example) that receive the latex code and convert to image (.gif) directly, so they're faster but they don't usually support all the LaTeX commands and packages (which is ok if you're just looking to use LaTeX for math expressions here and there rather than full-sized documents).

    Here's some links:
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook