4

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:

enter image description here

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

5
  • 1
    What's the problem with the more natural \left|\frac{1}{C}\int_0^1\frac{\sin t}{t}\,dt\right|?
    – egreg
    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.
    – egreg
    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
  • 1
    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…
    – Bernard
    Jul 25 at 10:13
5

When you use \left<ldelim><math>\right<rdelim>, TeX will measure the inner <math> and extend the two delimiters so as to cover the <math> 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}

enter image description here

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

6
  • 1
    Why not use vmatrix like Bernard mentions in a comment? Seems a lot easier
    – daleif
    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.
    – egreg
    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
    – daleif
    Jul 25 at 10:26
  • 1
    @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
    – egreg
    Jul 25 at 10:29
  • Ahh right, your example still have the line in the fraction in the same place
    – daleif
    Jul 25 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.