As suggested by the answer to my question here, I am using the Sphinx tool in order to multi-target PDF and HTML output. For HTML, I'm using the pngmath extension.

The vertical alignment of inline math in the HTML output is very bothersome. The math equations are positioned below where they should and this causes the entire rendered page to look bad because none of the equations are lined-up properly.

Does anyone know how this can be fixed?


See my question about exactly that, in short the solution is to add to conf.py:

pngmath_latex_preamble=r'\usepackage[active]{preview}' # + other custom stuff for inline math, such as non-default math fonts etc.

This "feature" is explained in sphinx docs.

  • Thanks! That fixed it. Why anyone would want that "feature" escapse me. – 3Sphere Jul 30 '11 at 19:01
  • They say it is because the preview package does not come installed with LaTeX in all distributions. Personally I think it would be better to force people install it, because it really looks horrible without it. – eudoxos Jul 31 '11 at 8:02

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.