how to make a balanced fraction

Package mathtools provides the command \mathrlap to write something to the right in math mode without allocating the space.

LaTeX's \hphantom can also be used in math mode to reserve horizontal space without typesetting the argument. For version with the long fraction line, an invisible subscript is put to the left.

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\[
  \frac{x}{\lVert x\rVert\mathrlap{_1}}
  =
  \frac{x}{\hphantom{_1} \lVert x\rVert_1}
\]
\end{document}

Result

The length of the fraction bar can be controlled by adding symmetrical space:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\begin{align*}
  &\frac{x}{\lVert x\rVert\mathrlap{_1}}
  =
  \frac{x}{\,\lVert x\rVert\mathrlap{_1}\,}
  =
  \frac{x}{\>\lVert x\rVert\mathrlap{_1}\>}
  =
  \frac{x}{\:\lVert x\rVert\mathrlap{_1}\:}
\\
  &\frac{x}{\hphantom{_1}\lVert x\rVert_1}
  =
  \frac{x}{\!\hphantom{_1}\lVert x\rVert_1\!}
  =
  \frac{x}{\!\!\hphantom{_1}\lVert x\rVert_1\!\!}
\end{align*}
\end{document}

Result

In the first case the subscript is decouple with the previous fence, because it is the in \mathrlap. The following example, fixes this by setting the denominator twice. The first time with the subscript, but the complete expression in \mathclap so that the subscript is right after the fence. The second time the denominator is set without the subscript in \hphantom for the space.

\documentclass{article}

\usepackage{mathtools}
\usepackage{mleftright}

\begin{document}
\[
  \frac{a}{             \mleft\lVert\frac{b}{c}\mright\rVert\mathrlap{_1}}
  =
  \frac{a}{   \mathrlap{\mleft\lVert\frac{b}{c}\mright\rVert_1}
              \hphantom{\mleft\lVert\frac{b}{c}\mright\rVert}}
  =
  \frac{a}{\hphantom{_1}\mleft\lVert\frac{b}{c}\mright\rVert_1}
\]
\end{document}

Result

Remarks:

  • Package mleftright is used for \mleft and \mright that use \left and \right but without the additional horizontal spacing.

  • \lVert and \rVert denotes that the \lVert is used as left fence and \rVert serves as right delimiter.


Simplest was is to move the subscript outside of the \frac{}{}:

\frac{x}{\left\Vert x \right\Vert}_{\!1}

and a little negative thinspace for better spacing. The second option can be achieved with a careful use of \makebox and \hphantom:

enter image description here

Code:

\documentclass{article}

\usepackage{mathtools}
\newcommand*{\WideAs}[2]{\makebox[\widthof{$#1$}][c]{$#2$}}

\begin{document}
\begin{equation*}
    \frac{x}{\left\Vert x \right\Vert}_{\!1}
    \quad
    \frac{\WideAs{\left\Vert x \right\Vert}{x}\hphantom{{}_1}}{\left\Vert x \right\Vert_1}
\end{equation*} 
\end{document}

Tags:

Fractions