Effortlessly Post Math Formulas with a LaTeX Parser/Converter on Your Website

  • Context: LaTeX 
  • Thread starter Thread starter XTTX
  • Start date Start date
  • Tags Tags
    Latex
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 12K views
XTTX
Messages
9
Reaction score
0
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)
 
Physics news on Phys.org
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:
http://us.php.net/manual/en/function.exec.php
http://www.miktex.org/
http://www.latex-project.org/
http://www.latex-community.org/
http://www.forkosh.com/mimetex.html