# Extra vertical space in fraction

If I compile this:

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
$\left\lvert\frac{\displaystyle\int_0^1\frac{\sin t}t\,\mathrm dt}C\right\rvert$
\end{document}


what I get is:

That vertical space below the letter C makes no sense. What is it due to? How to get rid of it?

• What's the problem with the more natural \left|\frac{1}{C}\int_0^1\frac{\sin t}{t}\,dt\right|? Jul 25 at 9:57
• @egreg Nothing! Of course it is more natural. Nevertheless, I would like to know where does that vertical space come from. Jul 25 at 9:59
• \left and \right make delimiters to grow until they cover the inner formula and they become symmetric with respect to the formula axis. Jul 25 at 10:00
• @egreg Thank you; I was unaware of the fact that the delimiters become symmetric with respect to the formula axis. Please post it as an answer. Jul 25 at 10:05
• It is possible to remove the vertical spacing using the vmatrix environment in the place of the pair \lvert … \rvert, but the result is not particularly æsthetic… Jul 25 at 10:13

When you use \left<ldelim>[itex]\right<rdelim>, TeX will measure the inner [itex] and extend the two delimiters so as to cover the [itex] and be symmetric with respect to the formula axis (where the main fraction line sits).

This is by design.

You might overcome the issue with some acrobatics.

\documentclass{article}
\usepackage{amsmath}

\newsavebox{\jcsboxA}
\newsavebox{\jcsboxB}

\newcommand{\uglyabs}[1]{%
\sbox\jcsboxA{$#1$}%
\sbox\jcsboxB{$\left|\begin{gathered}\usebox\jcsboxA\end{gathered}\right|$}%
\raisebox{\dimexpr\ht\jcsboxA-\ht\jcsboxB}{\usebox\jcsboxB}%
}

\begin{document}

$\uglyabs{\dfrac{\displaystyle\int_0^1\frac{\sin t}{t}\,dt}{C}} \qquad \left|\frac{1}{C}\int_0^1\frac{\sin t}{t}\,dt\right|$

\end{document}


Now that you know how to do it, avoid it.

• Why not use vmatrix like Bernard mentions in a comment? Seems a lot easier Jul 25 at 10:22
• @daleif Because it doesn't work, that's why. The main fraction line should sit on the formula axis, not somewhere random. For an isolated formula, it seems to work, but not in context. Jul 25 at 10:24
• Oh, so there's a difference on how they are implemented because the bmatrix and pmatrix worked the last time I tried Jul 25 at 10:26
• @daleif They will center the whole block with respect to the formula axis. Here's a picture if I add \qquad\begin{vmatrix}<the formula>\end{vmatrix} picture Jul 25 at 10:29
• Ahh right, your example still have the line in the fraction in the same place Jul 25 at 10:30