I'm trying to produce an html copy of my book, which is written in LaTeX using tex4ht. Things are going better than I expected. But in some places I use the equation environment and in others align. They look essentially the same in PDF, but results differ between the two environments when I use htlatex. Here is an example code sequence:


\begin{equation} \label{eq:radix}
\sum\limits_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}

\begin{align} \label{eq:radix}
\sum\limits_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}


Here are my questions:

  1. In my PDF version, when should I use equation and when should I use align? I have used equation for showing expressions and single-line equations, and I have used align for continuing equations.
  2. Is there a way using tex4ht to cause equation and align to produce the same visual results?

Question #1 is the more interesting one to me. I sell my book in both PDF and print-on-demand formats. The HTML version will be available free online, so formatting is less important. It would be nice, though, if the formatting in HTML were consistent between equation and align environments.

  • Welcome to TeX SE! Did you have a question?
    – cfr
    May 3, 2015 at 4:00
  • I don't know the answer for the first question, but you can try pic-align option in order to make the align look better. It seems that it is treated as inline math by default.
    – michal.h21
    May 3, 2015 at 19:03
  • @michal.h21 Could you tell how?
    – egreg
    Sep 5, 2015 at 17:05
  • 1
    For displays with a single equation use equation; for multiline displays you can choose between gather (no alignment) or align (and some other environments, actually).
    – egreg
    Sep 5, 2015 at 17:06

1 Answer 1


Summarising and expanding the comments.

equation is for single-lined numbered displays, align is for a multi-lined display with alignment points. For multi-lined displays with each line centered individually use can use gather instead of align.

There is a bug report https://puszcza.gnu.org.ua/bugs/?179 regarding tex4ht's treatment of align. Using the suggested option pic-align via

htlatex file "htlm,pic-align"

nearly gives identical results on your example:

Sample output

These equations are centered on the page, but note the different placement of the equation number.

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.