How could one achieve, as primitively as possible, left-aligned display math so that \abovedisplayshortskip would still work as intended?

It is my understanding that one can achieve left-alignment via an immediate \halign inside display math mode, but this makes (again, in my understanding) it occupy the whole width of the display, and hence makes it impossible for there to be \abovedisplayshortskip (or \belowditto).

Here is what I have now:

Some text $$\displaylines{\kern2\parindent % i.e. \halign
  a + b = c
\hfill}$$ and so continues the paragraph. Until
  • I guess you don't mention fleqn class option for some reason? ah yes I see from the sources that it sets \abovedisplayshortskip to be as \abovedisplayskip for eqnarray environment, but you could patch that. – user4686 Oct 23 '13 at 12:00
  • 1
    @jfbu - I believe the OP is looking for a PlainTeX rather than a LaTeX solution. – Mico Oct 23 '13 at 12:02
  • @Mico silly me, thanks for pointing that out. Maybe then looking at fleqn.clo will provide inspiration for a Plain TeX approach. – user4686 Oct 23 '13 at 12:04
  • An \halign would only take up the full width if you explicitly told it to do so. So the \begindisplay and \enddisplay macros from Appendix E of the TeXbook should work properly with \abovedisplayskip. – Thruston Oct 23 '13 at 12:06
  • 2
    @morbusg After some closer reading of Appx E, I notice that the definition there has (in effect) $$\halign{...}$$ which makes an "alignment display" which is formatted differently... As p.190 makes clear alignment displays always get \abovedisplayskip and never \abovedisplayshortskip. So you might want to experiment with wrapping the halign in a vbox and adjusting hsize. – Thruston Oct 23 '13 at 13:09

My first thought (you didn't wait long enough to get my answer) was to set the math left aligned in an \hbox that was shorter than the \displaywidth by twice the indentation value:

\mydisplayindent 2\parindent % 
\noindent OK:
  \hbox to \mydisplayboxwidth
    {$\mathsurround0pt \displaystyle a + b = c$\hss}
and so continues the paragraph.
  • Oh, it can be that straight-forward. Thanks! – morbusg Oct 24 '13 at 7:35

No takers? I'm sorry I'm doing the unthinkable and answering my own question.

Thanks to @Thruston for finding the relevant part from The TeXbook (p. 190):

TeX also allows “alignment displays”, which are not processed in math mode because they contain no formulas at the outer level. An alignment display is created by commands of the general form


where the <assignments> are optional things like parameter changes that do not produce any math lists. In such displays, the \halign is processed exactly as if it had appeared in vertical mode, and it will construct a vertical list v as usual, except that each row of the alignment will be shifted by the \displayindent. After the alignment and the closing assignments have been processed, TeX will put a \predisplaypenalty item and some \abovedisplayskip glue on the main vertical list, followed by v, followed by \postdisplaypenalty item and \belowdisplayskip glue.

(Emphasis mine.)

So building on this knowledge, one could do something like the following for \displaylines-like command with indenting (I've left out all the other things it's doing):


    $\displaystyle ##\hfil$\crcr

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
dolore te feugait nulla facilisi.$$
  \indentlines{ a + b = c. }
$$ Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua.

For some reason the \displayindent needs to be set inside display math mode and not outside.

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.