2

What is the easiest way to vertically align overbraces in math? In the following example...

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{math}
*(m, n) = (\overbrace{n - m}^\text{index}, \overbrace{\sum_{k=m}^{n-1}{\pi_{i_k}}}^\text{sum})
\end{math}

\end{document}

...because the second tuple element has greater vertical extent (due to the summation), the brace appears higher than the other one. I would like to have "index" and "sum" on the same baseline:

enter image description here

6

Perhaps easiest is to use \vphantom to make a strut the size of the larger expression

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newcommand\suma{\sum_{k=m}^{n-1}{\pi_{i_k}}}
\begin{math}
*(m, n) = (\overbrace{\vphantom{\suma}n - m}^\text{index}, \overbrace{\suma}^\text{sum})
\end{math}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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