[Tex/LaTex] Proper display of fractions

displaystylefractionsmath-mode

Have a look at the following code:

\documentclass[letterpaper]{article}
\usepackage{amsmath,amssymb}
\begin{document}
 $2-\frac{2}{1-\left(\frac{2}{2-\frac{2}{x^2}}\right)}$\quad
 $2-\dfrac{2}{1-\left(\dfrac{2}{2-\dfrac{2}{x^2}}\right)}$\quad
 $2-\cfrac{2}{1-\left(\cfrac{2}{2-\cfrac{2}{x^2}}\right)}$\quad
 $2-\dfrac{2}{1-\left(\cfrac{2}{2-\dfrac{2}{x^2}}\right)}$
\end{document}

This gives:

enter image description here

Evidently, the first display is not the proper way. The second and last are the same I guess. The third has a better display but there is too much space above the 2 in \left(\cfrac{2}{2-\cfrac{2}{x^2}}\right). Essentially, non of the above displays satisfies, for me, a good Mathematical typsetting. Although, it may be argued that it is the default in LaTeX. I just can't get it right? Any insights? In a book I got this example from it looks like this without the excessive bold (this is a scanned image):

enter image description here

Best Answer

You can use \raisebox{<length>}{<text> to shift the content up as desired.

So using it to shift up the content with in the large brackets you get:

\[ 2-\frac{2}{1-\left(\raisebox{0.5ex}{$\displaystyle\frac{2}{2-\frac{2}{x^2}}$}\right)} \]

you get:

enter image description here

If you also want the 1 - to be aligned with the fraction's vinculum, you can apply \raisebox to that as well:

enter image description here

I personally think the above looks the best, but if you desire the last fraction in \displaystyle as well then the fraction size increases and the shift amount applied by \raisebox also needs to be increased:

enter image description here

Note:

  • \raisebox expects text as its parameter so you need to put that content within math mode.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
    2-\frac{2}{1-\left(\raisebox{0.5ex}{$\displaystyle\frac{2}{2-\frac{2}{x^2}}$}\right)}
\]
If you want the minus sign aligned with the fraction:
\[
    2-\frac{2}{\raisebox{0.5ex}{$1-$}\left(\raisebox{0.5ex}{$\displaystyle\frac{2}{2-\frac{2}{x^2}}$}\right)}
\]
If you want the last fraction to be in 
\verb|\displaystle| as well:
\[
    2-\frac{2}{\raisebox{1.1ex}{$1-$}\left(\raisebox{1.1ex}{$\dfrac{2}{2-\dfrac{2}{x^2}}$}\right)}
\]
\end{document}