2

I've got a number of equations in a LaTeX document written in display mode. I'm using a *.sty file to be able to typeset them (inference rules).

I want to get *.svg versions of these into an HTML document programmatically.

Is there some way to either:

  1. generate *.svg files per equation in display mode? or
  2. add custom *.sty files (in my case for inference rules) to something like MathJax so I can write my LaTeX inference rules in an HTML document?
  • Depending on your use case, github.com/Khan/KaTeX may be a better choice. But it's definitely not TeX. – TH. Jun 22 '17 at 17:57
  • you can add simple \newcommand and \def to mathjax but as you have given no example code its inpossible to say whether mathjax would understand the definitions you are using. – David Carlisle Jun 22 '17 at 18:41
3

You can use tex4ht for that. You didn't provide a sample file, but generally, you will need simple configuration file to request math to be converted as image and to declare image output format to SVG.

Save the following file as mycfg.cfg:

\Preamble{xhtml,pic-align,pic-m+,pic-array,pic-cases,pic-eqalign,pic-eqnarray,pic-matrix}
\Configure{Picture}{.svg}  
\begin{document}
\EndPreamble

Your document can be then compiled using

make4ht -uc mycfg.cfg filename.tex

You should get HTML file with all math content as SVG images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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