fixed columns in math mode

Michael Shell list1 at
Sun Sep 12 08:21:30 CEST 2021

On Fri, 10 Sep 2021 14:22:14 +0200 (CEST)
karl at wrote:

> Is there any \makebox-like thing that works in math mode so I can set the
> contents width, or rather where the next thing will land?


You are asking for a math mode equivalent of Scott Pakin's eqparbox package:

i.e., "inter-alignment alignments"

Using Pakin's approach with math mode (which I haven't actually tried
myself) you would have to put everything back into math mode within the
eqparbox's. The big benefit here is that eqparbox would autocalculate the
reserved width (the maximum width) you need for a given column. Be aware
that you will have to rerun LaTeX when changes are made to the columns
that increase the maximum width because eqparbox will only know the maximum
width value after it has finished processing the entire document - if the
maximum width has changed since the start of the run (starting with the
value imported from the previous run via the .aux file), a rerun will be

Whether or not you use simple manual or Pakin-type automatic setting of the
reserved widths, there is a way to coax IEEEeqnarray to do as you need. The
trick is to insert a phantom/strut row that reserves the needed width in
the given columns without otherwise altering the formatting (i.e., we must
remove any extra vertical spacing caused by this phantom row).

The code below shows an example of use. Do let us know if this does as
you need. In this example, I specified the reserved width as a percentage
of the column width rather than in points. This should help to make the
setting more likely to be acceptable for a variety of content (i.e., it
will work fine as long as the given IEEEeqnarray column(s) does not exceed
30% of the text width.) 


  Mike Shell

% Test document showing fixed length columns under IEEEeqnarray
% by Michael Shell 9/11/2021


% length to hold interline spacing used by \IEEEeqnarray
% \MYstdeqnarrylinespacing = \baselineskip + \jot

% invisible phantom/strut row
% adjust width as needed, must be at least as large as the widest element
% whose width is to become irrelevant in the alignment instances.
% for diagnostic purposes, to make this strut visible, set the height of
% both rules to something nonzero such as 0.2pt
\newcommand{\MYeqnarrayphantomrow}{\hbox{\vrule height 0pt depth 0pt width 0.3\columnwidth}&&\hbox{\vrule height 0pt depth 0pt width 0.3\columnwidth}\\*[-\MYstdeqnarrylinespacing]}


\title{A Test Example of Fixed Width IEEEeqnarray Columns}
\author{Michael Shell}
\date{\scriptsize (September 11, 2021)}

Test 1 (no phantom row):
a & = & x

Test 2 (with phantom row, the result is the same as above):
a & = & x

Test 3 (wider LHS, with phantom row):
a+b+c & = & y

Test 4 (like test 3, but without phantom row, note alignment failure):
a+b+c & = & y

Test 5 (much wider RHS, with a phantom as well as a second row):
a+b+c & = & y+z+\alpha+\beta+\delta+\gamma\\
b & = & g 

Tests 2, 3 and 5 will maintain their alignment of the = in the center
of the page column, as long as the content of the first and third columns
of the IEEEeqnarrays does not exceed the space reserved in \textbackslash
MYeqnarrayphantomrow, which in this test case is
0.3\textbackslash columnwidth.

As a diagnostic, to make the phantom rows visible, set the two rule
heights in the definition of \textbackslash MYeqnarrayphantomrow to
something nonzero, such as 0.2pt. Then you can easily see via
inspection if you have reserved enough space for the given content.


More information about the tex-live mailing list.