TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to underbrace multiple lines in an align-environment with one brace. Meaning something like

 A ={}& B + \underbracemultiline{C + D + E \\
      & + F + G \\
      & + H + I \\
      & + J + K}_{=:M} + L

results in (a nice version of)
Another possible syntax would be

 A ={}& B + \under{brace}{line}{dots}{C + D + E} \\
      & \under{dots}{brace}{dots}{+ F + G}_{=:M} \\
      & \under{dots}{line}{dots}{+ H + I} \\
      & \under{dots}{line}{brace}{+ J + K} + L

where the macro

\under{begin}{middle}{end}{What to under"line"}

is as needed for the example. How can I do this?


share|improve this question
up vote 11 down vote accepted

\underbrace is constructed from bits so you just need to copy its definition using different bits each time:

enter image description here



\def\upbracefilla{$\m@th \setbox\z@\hbox{$\braceld$}%
  \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill 
\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@


\def\upbracefillb{$\m@th \setbox\z@\hbox{$\braceld$}%
\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@
 \leaders\vrule \@height\ht\z@ \@depth\z@\hfill\bracerd
  \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill
\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@


\def\upbracefillc{$\m@th \setbox\z@\hbox{$\braceld$}%
\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@
\leaders\vrule \@height\ht\z@ \@depth\z@\hfill
\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@

\def\upbracefill{$\m@th \setbox\z@\hbox{$\braceld$}%
\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@\vrule \@width\p@\kern\p@
 \leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}


 A ={}& B + \underbracea{C + D + E} \\
      &\underbraceb{{} + F + G}_{=:M} \\
      &\underbracec{{}+ H + I} \\
      &\underbraced{{} + J + K} + L

share|improve this answer
Perfect thanks! – Elgrimm Mar 26 '13 at 16:58

Your Answer


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.