Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to vertically aling an equation number for the following MWE:

\documentclass{scrartcl}
\usepackage{amsmath}

\usepackage{mathtools}
\begin{document}
\begin{align}
\begin{aligned}
a &= b \\
  &= \underbrace{d+e}_{\substack{\text{Long}\\\text{text}}}
\end{aligned}
\end{align}

\begin{equation}
\begin{multlined}
a+b+c+d+e+f+{}\\
g+h+i+\underbrace{i+j}_{\substack{\text{Long}\\\text{text}}}
\end{multlined}
\end{equation}
\end{document}

In both cases underbrace increases the size of the second line and thus, the equation number is not exactly between the two lines. How do I fix this?

This question can be understood as a follow up question of A vertically centered equation number on a multline environment.

Result of working example

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

This works, but requires some manual intervention. The \underbrace can be \smashed to align the equation number as you want. But then, some \vspace needs to be added or the thing following the equation will sit too high.

\documentclass{scrartcl}
\usepackage{amsmath}

\usepackage{mathtools}
\begin{document}
\begin{align}
\begin{aligned}
a &= b \\
  &= \smash{\underbrace{d+e}_{\substack{\text{Long}\\\text{text}}}}
\end{aligned}
\end{align}
\vspace*{3ex}
\begin{equation}
\begin{multlined}
a+b+c+d+e+f+{}\\
g+h+i+\smash{\underbrace{i+j}_{\substack{\text{Long}\\\text{text}}}}
\end{multlined}
\end{equation}
\vspace*{3ex}

Next line
\end{document}

enter image description here

share|improve this answer
    
I accept this as a sufficient workaround because it only occurs at limited places in my document. –  Lukas Jan 30 at 13:03
    
I think a more general answer could include the following: Always align in the middle of the two inner lines for an even number of lines. Always align to the center of the middle line for an odd number of lines. –  Lukas Jan 30 at 13:21
1  
@Lukas Such advice is good. The problem arises because the package algorithms don't/can't always follow that advice without some "help", if abnormalities are introduced in the layout of the multi-line entity. In this case, the \underbrace constitutes such an abnormality. –  Steven B. Segletes Jan 30 at 13:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.