Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to convert a LaTeX document to a webpage that'll be hosted on a server that's capable of processing and rendering simple TeX equations, but not doing section-level formatting.

So I'm trying to convert the document to HTML using TeX4ht, but leave the equations in the form $ my-eq-here $ in the resulting HTML to have the server process them and be able to modify them later. Any ideas on how to accomplish this using TeX4ht?

share|improve this question
add comment

1 Answer

htlatex provides support for jsMath out of the box:

htlatex file "xhtml,jsmath" " -cmozhtf"

If you need output for a different engine, htlatex offers fine control on how math is to be output. In the Q/A section of the manual an example is shown that can be adapted to any use case.

To output the original LaTeX source surrounded by $ signs, create a file my.cfg in the same directory as the main .tex file with the following contents:

\Preamble{html}
\newtoks\eqtoks 
\def\AltMath#1${\eqtoks{$#1$}% 
   \HCode{\the\eqtoks}$}
\Configure{$}{}{}{\expandafter\AltMath}  
\begin{document} 
\EndPreamble

Now the command

htlatex file 'my'

produces a HTML file where the all inline equations are represented as their (equivalent) LaTeX source.

You can use the same switches after my as with html. Replace {html} by {xhtml} in my.cfg to get XHTML output.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.