Technical notes on equation breaking

MJD

September 1, 2001

The method used by the breqn package to place the equation number is rather more complicated than you might think, and the whole reason is to allow the number to stay properly centered on the total height even when the height fluctuates due to stretching or shrinking of the page.

Consider the following equation:

(3.15)  N_{0} ∼ (\frac{η}{∥u∥_{H^{1}}} )^{5} |I|^{−1/2}

It will have only one line, if the column width is not too narrow.

Scrutinizing the vertical list will shed light on some of the basic properties shared by all breqn equations. After that we will look at what would happen if two or more lines were needed. The numbers added on the left in the following \showlists output mark the points of interest.

[1]   \penalty 10000
      \glue(\abovedisplayskip) 0.0
      \penalty 10000
      \glue(\belowdisplayskip) 0.0
[2]   \glue 4.0 plus 4.0
      \glue(\lineskip) 1.0
[3]   \vbox(16.53902+0.0)x0.0, glue set 16.53902fil
      .\glue 0.0 plus 1.0fil minus 1.0fil
      \penalty 10000
[4]   \glue -8.51945
[5]   \hbox(7.5+2.5)x25.55563
      .\OT1/cmr/m/n/10 (
      .\OT1/cmr/m/n/10 3
      .\OT1/cmr/m/n/10 .
      .\OT1/cmr/m/n/10 1
      .\OT1/cmr/m/n/10 5
      .\kern 0.0
      .\OT1/cmr/m/n/10 )
      \penalty 10000
[6]   \glue(\parskip) -18.01956
[7]   \hbox(16.53902+9.50012)x360.0, glue set 1.78647

1. These four lines are a hidden display structure from TEX’s primitive $$ mechanism. It is used only to get the value of \predisplaysize so that we can later calculate by hand whether to use the short display skips or the regular ones. (The reason that we have to do it by hand traces back to the fact that TEX 3.x does not allow unhboxing in math mode.) The penalties come from

\predisplaypenalty and \postdisplaypenalty, which were locally set to

10000 to ensure there would be no unintended page breaks at these glue nodes.

2. These two glue nodes are the ones that would normally have been produced at the top of a display; the first one is the above-display skip node (though we had to put it in by hand with \vskip) and the second one is the usual baselineskip/lineskip node.

3. This is a dummy copy of the equation’s first line, which is thrown in here to get the proper value of baselineskip (or lineskip in this case). Why do we need this? Because this ensures that we get the top spacing right before we fiddle with the glue nodes surrounding the equation number. And if the equation has a frame, this box is a good place to add it from.

4. This is a special glue node that brings us to the right vertical position for adding the equation number. Its value is calculated from the variables that you would expect, given the presence of the dummy first line above the number: starting position of the equation, height of first line, total height of equation body. If the equation body had more than one line, with stretchable glue between the lines, half of the stretch would be added in this glue node.

5. The hbox containing the equation number.

6. Backspace to bring the equation body to the right starting point. We use \parskip to put this glue in place because we’re going to get a parskip node here in any case when we add the equation body with (in essence). If we didn’t do this we’d get two glue nodes instead of one, to no purpose.

\noindent \unhbox\EQ@box

7. And lastly we see here the first line of the equation body, which appears to have height 16.5pt and depth 9.5pt.

For comparison, the vertical list produced from the above equation in standard L^{A}TEX would look like this, if the same values of columnwidth and abovedisplayskip are used:

[1]   \penalty 10000
[2]   \glue(\abovedisplayskip) 4.0 plus 4.0
 \glue(\lineskip) 1.0
 \hbox(16.53902+9.50012)x232.94844
[3]   .\hbox(7.5+2.5)x25.55563
 ..\hbox(7.5+2.5)x25.55563

...\OT1/cmr/m/n/10 (
...\OT1/cmr/m/n/10 3
...\OT1/cmr/m/n/10 .
...\OT1/cmr/m/n/10 1
...\OT1/cmr/m/n/10 5
...\kern 0.0
...\OT1/cmr/m/n/10 )
.\kern101.49591
[4]   .\hbox(16.53902+9.50012)x105.8969
 ...
[5]   \penalty 0
[6]   \glue(\belowdisplayskip) 4.0 plus 4.0
\glue(\lineskip) 1.0
\hbox(6.94444+1.94444)x345.0, glue set 62.1106fil
1. \predisplaypenalty
2. \abovedisplayskip

3. equation number box

4. equation body

5. \postdisplaypenaltly
6. \belowdisplayskip