# Fraction within another fraction

Im using the code as shown below to write a step by step for a question but when i have a fraction in another fraction it becomes small and hard to read. i wish to make the faction inside the same size as the other and clear but not too crowded.

\begin{align*}
\frac{\sin(a+b)}{\cos(a+b)}&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b}
\\
\tan(a+b)&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b}
\\
&=\frac{\frac{\sin a \cos b}{\cos a \cos b} + \frac{\cos a \sin b}{\cos a \cos b}}{\frac{\cos a \cos b}{\cos a \cos b} - \frac{\sin a \sin b}{\cos a \cos b}}
\\
&=\frac{\frac{\sin a}{\cos a} + \frac{\sin b}{\cos b}}{1 - \frac{\sin a \sin b}{\cos a \cos b}}
\\
&=\frac{\tan a +\tan b }{1 - \tan a \tan b}
\end{align*}


• Add \displaystyle before the small fraction, or (with amsmath), use \dfrac. – Steven B. Segletes Feb 24 at 18:57
• when i do that there ends up having a really small gap between the small fraction bottom and big fractions line and other small fraction top – Jettie Baker Feb 24 at 19:00

You can use \cfrac for nested fractions. However this makes the ‘upper’ denominators too close from the main fraction line, so one can compensate adding a phantom letter with descenders. No compensation required for the ‘lower’ numerators if you use \cfrac (not \dfrac).

Another possibility would use the \mfrac(medium-sized fraction – 80 % of \displaystyle) command from nccmath, so the smaller fractions are still readable. Here is an example of both methods:

\documentclass{article}
\usepackage{amsmath, nccmath}

\begin{document}

\begin{align*}
\frac{\sin(a+b)}{\cos(a+b)}&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b}
\\
\tan(a+b)&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b}
\0.5ex] &=\frac{\cfrac{\sin a \cos b}{\cos a \cos b} + \cfrac{\cos a \sin b}{\cos a \cos b\vphantom{g}}}{\cfrac{\cos a \cos b}{\cos a \cos b} - \cfrac{\sin a \sin b}{\cos a \cos b}} \\[0.5ex] &=\frac{\cfrac{\sin a}{\cos a} + \cfrac{\sin b}{\cos b \vphantom{g}}}{1 - \cfrac{\sin a \sin b}{\cos a \cos b}} \\[0.5ex] &=\frac{\tan a +\tan b }{1 - \tan a \tan b} \end{align*}\medskip \begin{align*} \frac{\sin(a+b)}{\cos(a+b)}&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b} \\ \tan(a+b)&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b} \\[0.5ex] &=\frac{\mfrac{\sin a \cos b}{\cos a \cos b} + \mfrac{\cos a \sin b}{\cos a \cos b\vphantom{g}}}{\mfrac{\cos a \cos b}{\cos a \cos b} - \mfrac{\sin a \sin b}{\cos a \cos b}} \\[0.5ex] &=\frac{\mfrac{\sin a}{\cos a} + \mfrac{\sin b}{\cos b\vphantom{g}}}{1 - \mfrac{\sin a \sin b}{\cos a \cos b}} \\[0.5ex] &=\frac{\tan a +\tan b }{1 - \tan a \tan b} \end{align*} \end{document}  To remedy the small (\textstyle) equations, as I said in a comment, add \displaystyle before the small fraction, or (with amsmath), use \dfrac. However, that does not address the narrow vertical gap between really tall equations. With a TABstack, the gap between equations can be easily specified. Here, because the equation(s) is/are unnumbered, and the height of each equation is different, I choose a \alignShortstack instead of an \alignCenterstack \documentclass{article} \usepackage{amsmath,tabstackengine} \TABstackMath \TABstackMathstyle{\displaystyle} \begin{document} \[ \setstackgap{S}{16pt} \alignShortstack{ \frac{\sin(a+b)}{\cos(a+b)}&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b} \\ \tan(a+b)&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b} \\ &=\frac{\dfrac{\sin a \cos b}{\cos a \cos b} + \dfrac{\cos a \sin b}{\cos a \cos b}}{\dfrac{\cos a \cos b}{\cos a \cos b} - \dfrac{\sin a \sin b}{\cos a \cos b}} \\ &=\frac{\dfrac{\sin a}{\cos a} + \dfrac{\sin b}{\cos b}}{1 - \dfrac{\sin a \sin b}{\cos a \cos b}} \\ &=\frac{\tan a +\tan b }{1 - \tan a \tan b}}
\end{document}


with use of amsmath and manuals increased vertical distance between math equation's lines:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
\frac{\sin(a+b)}{\cos(a+b)}
&=\frac{\sin a \cos b + \cos a \sin b}{\cos a \cos b - \sin a \sin b}               \\
\tan(a+b)
&=\frac{\sin a \cos b + \cos a \sin b\mathstrut}{\cos a \cos b - \sin a \sin b}      \\[1ex]
&=\frac{\dfrac{\sin a \cos b}{\cos a \cos b\mathstrut} + \dfrac{\cos a \sin b}{\cos a \cos b}}
{\dfrac{\cos a \cos b}{\cos a \cos b} - \dfrac{\sin a \sin b}{\cos a \cos b}}\\[1ex]
&=\frac{\dfrac{\sin a}{\cos a} + \dfrac{\sin b\mathstrut}{\cos b}}
{1 - \dfrac{\sin a \sin b}{\cos a \cos b}}                                   \\[1ex]
&=\frac{\tan a +\tan b }{1 - \tan a \tan b}
\end{align*}
\end{document}


edit: now is considered comment of Barbara Beeton.

• The fractions in the numerator appear too close to the fraction line compared to what's below the fraction line. This might be improved by adding \mathstrut to each of the denominators in the numerator fractions. (But it will probably never look wonderful.) – barbara beeton Feb 24 at 19:22
• @Zarko: I'm sorry, Iinadvertently posted an image of my resulting pdf with your answer instead of my answer. Can you undo what I did? – Bernard Feb 24 at 20:05
• i will add edit my answer with my edit ... – Zarko Feb 24 at 20:06
• @barbarabeeton, thank you very much. i consider your suggestion in my answer. – Zarko Feb 24 at 20:09