2

Using the standard "align"-command, I cannot find a way to center equations between alignment characters. Is there a different environment which is better suited for this problem? My problem is as follows

\begin{align}
  a &=& \underbrace{\text{insert long equation here}} &=& \text{something}\\
    &=& b &=& \text{something}
\end{align}

where now the b would be displayed leftbound on the equals sign. I would like if it was displayed centered between the 2 equal signs, preferably right below the underbrace. I know that I can also add it to the underbrace, but that is not what I'm looking or.

1

1 Answer 1

5

You can use eqparbox; the first argument is an arbitrary label (which should be unique per usage).

Better use alignat, for this display. In any case, &=& is incorrect with align and the other amsmath environments.

\documentclass{article}
\usepackage{amsmath}
\usepackage{eqparbox}

\newcommand{\matheqbox}[2]{\eqmakebox[#1][c]{$\displaystyle#2$}}

\begin{document}

\begin{alignat}{2}
  a &= \matheqbox{A}{\underbrace{\text{insert long equation here}}} &&= \text{something}\\
    &= \matheqbox{A}{b}                                             &&= \text{something}
\end{alignat}

\end{document}

enter image description here

3
  • Can your elaborate, why using &=& is incorrect with align? I know that "it works" is not a good reason for it to be correct, but it has worked for me quite well so far and I don't see any problems.
    – Sellerie
    Jul 11, 2018 at 11:32
  • @Sellerie Did you notice how big is the space after = in the &=& case?
    – egreg
    Jul 11, 2018 at 11:38
  • No, I didn't, but I guess you are right. Working with only one alignment-character appears to be better suited. Thanks so far. Also thank you for showing me the alignat-command, which might be much more suited in many equations.
    – Sellerie
    Jul 11, 2018 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .