fixed columns in math mode

karl at karl at
Fri Sep 10 14:22:14 CEST 2021

Any ideas how to solve the problem below or how to find a nicer
solution ?

I'm trying to write some text with formulas interspaced with comments,
but i want to have the equalsign (or something else) and possible some
if's (at right) at the same "columns" in the text.

See e.g. page 11 and 14 of the current result:
with source in:


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 ?


I have tried with the array, IEEEeqnarray and some other environments
but they didn't do what I wanted so I came up with

\makebox[\widthB]{$\displaystyle{#3}$\hfill }%

That way I can have
. the "=" and the if's (#2, #4) at the same position
. the "between" equations text at left, just where ordinary text is
. page breaks can happen between equation lines just as it does for
  ordinary text

There is a problem with this, since the line ends doesn't know about
\displaystyle{} (my guess), so I have to add \\[1ex] and similar.


And I cannot figure out how to make a macro of

\makebox[\widthA]{$\hfill\displaystyle{\max i_L}$}%
%\makebox[\widthB]{$\displaystyle{A}$\hfill }deldrift\\[1ex]
\text{\makebox[\widthC]{$\displaystyle{- I_B P_B}$\hfill }deldrift}\\[1ex]
\text{\makebox[\widthC]{$\displaystyle{- I_{LPP}}$\hfill }gränsdrift}\\[1ex]
\text{\makebox[\widthC]{$\displaystyle{- \frac{I_{LPP}}{2} + \frac{-I_{ut}}{P_B}}$\hfill }heldrift}\\[1ex]

I.e. something similar to:

 |x| =
   -x & \text{if } x < 0,\\
    0 & \text{if } x = 0,\\
    x & \text{if } x > 0.

/Karl Hammar

More information about the tex-live mailing list.