# Bracing fraction numerator or denominator to the left or right

I have a fraction with further fractions in both the numerator and denominator. I wish to label the fractions in the numerator and denominator with braces to the right. I would like these braces to span the full height of the fractions but I would not like them to extend the fraction line any further.

I have tried \frac{a}{\left.\frac{b}{c}\right}} which achieves the former but not the latter and I have tried \frac{a}{\frac{b}{c}\mathrlap{\}}} which achieves the latter but not the former, since I can't put one half of the \left \right pair inside \mathrlap and the other half outside.

• How often do you need this construction? If it's a one time thing you could simply use \big,\Big,... e.g. \frac{a}{\frac{b}{c}\mathrlap{\big\}}} – Jesper Ipsen Mar 16 '13 at 16:17
• While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Mar 16 '13 at 16:24

Perhaps what you are looking for is a combination of \mathrlap and \smash which is what is incorporated in the \BraceRight and \BraceLeft macros.

However, as HendrikVogt pointed out, this requires that there be manual spacing added afterwards if there is text that follows it. To alleviate this issue I have defined two more macros \FracBraceBottomRight and \FracBraceBottomLeft which also add the approriate \hptantom after or before the fraction.

One downside of this this is that you need a different macro in case you desire further options (such as optional braces around either side of the numerator. This can be fixed with a better interface to enable/disable the appropriate brace, but I think that that is more of a question of coming up with the better UI.

## Code:

\documentclass{article}
\usepackage{mathtools}

\newcommand*{\BraceRight}[1]{#1\mathrlap{\smash{\left.\vphantom{#1}\right\}}}}%
\newcommand*{\BraceLeft}[1]{\mathllap{\smash{\left\{\vphantom{#1}\right.}}#1}%

\newcommand{\BracKern}{\kern-\nulldelimiterspace}
\newcommand*{\FracBraceBottomRight}[2]{%
\frac{#1}{#2\mathrlap{\smash{\left.\BracKern\vphantom{#2}\right\}}}}%
\hphantom{\left.\vphantom{#2}\right\}}%
}%
\newcommand*{\FracBraceBottomLeft}[2]{%
\hphantom{\left\{\vphantom{#2}\right.\BracKern}%
\frac{#1}{\mathllap{\smash{\left\{\vphantom{#2}\right.}}#2}%
}%

\begin{document}
Requires manual spacing:

$\frac{a}{\frac{b}{c}}$\quad%
$\frac{a}{\BraceLeft{\frac{b}{c}}}$\quad%
$\frac{a}{\BraceRight{\frac{b}{c}}}$

\bigskip
Auto spacing with \verb|\hphantom|:

$\FracBraceBottomRight{a}{\frac{b}{c}}$%
$\FracBraceBottomRight{a}{\frac{b}{c}}$%
$\FracBraceBottomLeft{a}{\frac{b}{c}}$%
$\FracBraceBottomLeft{a}{\frac{b}{c}}$
\end{document}

• Note that the brace will produce an overlap with material after the fraction. – Hendrik Vogt Mar 16 '13 at 16:33
• @HendrikVogt: Yep just noticed that when doing the macro verion. Best fix I can think of is to have a macro that accepts the numerator and denominator of the fraction as paramaters and then adds the brace with an appropriate \hphantom following. But, for the general case, this would require numerous different macros depending on if you perhaps wanted the brace on the top/bottom, left/right or any combinations of these. Of course there is always the tikz way. :-) – Peter Grill Mar 16 '13 at 16:41
• Yep, you'll need an appropriate \hphantom after the fraction. – Hendrik Vogt Mar 16 '13 at 16:44