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 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.

share|improve this question
    
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\}}} –  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

1 Answer 1

up vote 4 down vote accepted

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

enter image description here

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.

enter image description here

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.

References:

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}%

% http://tex.stackexchange.com/questions/54023/how-to-compute-exact-width-added-by-left-right
\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}
share|improve this answer
    
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

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.