22

The main differences between align and equation are the spaces and that align cannot be used with split, as far as I know.

What would be, from a typographic point of view, the preferred practice? What reasons are there for:

  • mixing equation and align in one document (i.e. using equation for one line equations and align for multiline ones),
  • using only equation (with split for multilines),
  • using only align,
  • using other possibilities?

Edit

If it's intended that one uses more space when you have multiline equations i.e. if it's preferred to mix align and equation, then one might ask further: Why isn't for example align implemented in this way, i.e. why is it that it detects if it's a single line equation or a multiline one and add the appropriate space before and after the equation?

  • You can use alignedwithin align (or within equation as well)? – Bernard Nov 4 '15 at 9:29
  • 4
    The main difference between align and equation is surely that align does alignment and equation does not. – David Carlisle Nov 4 '15 at 11:08
  • 3
    @DavidCarlisle - I would have said that alignment was the main difference between align (yes) and gather (no). After all, what is a single-line equation supposed to be aligned to, assuming no split or aligned environment is being employed? :-) – Mico Nov 4 '15 at 13:28
  • Regarding your follow-up question: I'm not in a position to answer it authoritatively. However, I would venture a guess that back when the amsmath package was assembled, computing power and RAM were real and binding constraints. Thus, anything that wasn't essential couldn't be accommodated. The extra overhead needed to check if an align environment consists of one or more lines (and then adjust the vertical spacing) may have been quite significant. Anyway, what, if anything, is a problem with having to memorize the names of two separate environments? – Mico Nov 8 '15 at 14:24
  • @Mico Thanks for your comment. Memorizing is not a problem for me, but maybe for other users. The annoying thing for me is, if I mix equations and align and I later decide to add a line to an equation I need to change the environment from align to equation (and also the other way around). By the way: If you want to make a feature request for this: where to ask? – student Nov 8 '15 at 14:39
26

For the typographic comparison you're looking to make, we need to distinguish between two groups of environments that generate display-style equations:

  • Methods for generating (mostly) single-line equations, such as the \[ ... \] approach and the displaymath, equation, and equation* environments.

  • Methods for generating multi-line equations (although they can be abused to create single-line equations), such as the gather, align, and multline environments.

The reason this distinction is important from a typographic point of view is that the latter group always inserts \abovedisplayskip and \belowdisplayskip above and below the respective environment. In contrast, the former group checks the length of the line that comes immediately before the environment: if the line is short, \abovedisplayshortskip and \belowdisplayshortskip are inserted instead of \abovedisplayskip and \belowdisplayskip. Only if the preceding line is long do the latter two length parameters come into play.

The consequence is that with \[ ... \] approach and the displaymath, equation, and equation* environments, LaTeX is given a chance to typeset the math material more compactly -- something that cannot happen if gather and/or align environments are (mis-)used for single-line displayed equations.

Another important aspect is that no page breaks are possible inside split and aligned environments, whereas it's possible to have page breaks inside gather and align environments (e.g., by issuing the instruction \allowdisplaybreaks).

  • What is the typographic reason that multiline environments insert \abovedisplayskip and \belowdisplayskip? What would be your conclusion for best practice? Mix them? But what about consistency? – student Nov 4 '15 at 9:43
  • 1
    @student - I'd say it makes sense to try hard to make a single-line equation "fit in" nicely in the surrounding material,to avoid creating visual "holes" in the text block. In contrast, once you have an equation that spans several lines, there's little chance of preserving constant or average grayness on a page. – Mico Nov 4 '15 at 10:23
  • You are talking about the AMS environments, right? – vonbrand Nov 4 '15 at 20:08
  • 1
    @vonbrand - The displaymath and equation environments are provided in the LaTeX kernel, the others (e.g., align and gather as standalone environments, split and aligned as a non-standalone environments) are provided by the amsmath package. I deliberately didn't mention the heavily deprecated eqnarray environment. – Mico Nov 4 '15 at 20:12
  • 3
    @Mico: The length of the line after the equation is never considered to decide whether to insert \belowdisplayskip or \belowdisplayshortskip: when the line before the equation is short (resp. long), \abovedisplayshortskip (resp. \abovedisplayskip) is inserted before and \belowdisplayshortskip (resp. \belowdisplayskip) after. (Personally, I think that, while it is natural to move the equation up when the line before is short, setting \abovedisplayskip and \belowdisplayskip to the value of \belowdisplayshortskip would be more logical.) – Michel Fioc Nov 5 '15 at 13:43
10

Reading the amsmath package documentation you'll find that split (only usable within another environment) is for splitting a single equation on more than one line (e.g. when the equation is too long), while the align environment is for typesetting multiple equation (possibly related to one another) aligned in the same display environment

I think this answers your question: depending on what you have to typeset, you can choose the best environment.

  • 2
    Completely agree. The corollary is that this is also reflected in the equation numbering - a single number on split, one on each line of align. – Andrew Swann Nov 5 '15 at 17:01
5

Do you want an equation? Then use equation or \[ .. \] (or equation* if you want it not to be numbered). Do you want more than one equation together with no text in between? Then use gather(*) (if no alignment is necessary) or align(*) if you want to align them at certain points. To me that's the way of deciding what to use.

Now, if it's a single equation that has to be split over a few lines, then use split inside it. If you need a particular alignment inside that equation (for instance defining a map \!\begin{aligned} f \colon A &\to B \\ x &\mapsto f(x) \end{aligned} or use multlined if a part of the equation is too long and has to be split).

Of course, may be there are exceptions, but I think this is a straightforward way of choosing (rather than choosing, understanding) what environments to use.

  • Yes, but what are the typographic reasons to use different spacings with this method. – student Nov 4 '15 at 20:25
  • 1
    Not really typographic by thought, but implied typography: I think that's the inteded use for those environments, so whoever wrote the code (or will rewrite the code) must have looked at guides or taken decisions based on ideas that imply that that's the best way. Or at least I hope so. – Manuel Nov 4 '15 at 20:42

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.