# Incorrect delimiter size in math mode

The following code

\documentclass{article}

\begin{document}

$\left|\tilde{\theta}\right|$
$\left|\theta\right|$
\end{document}

produces the following output using pdfLaTeX (TeXLive 2012 updated)

Apparently, there is something wrong with the size of | in the tilded-theta case. The same also applies to parentheses, etc.

Can I fix this?

Of course I can always manually choose the size of | each time (e.g. with \big|, etc), however, I'd rather not do that.

This question maybe linked to this one.

• Don't use \left and \right for these cases. You don't need that the fences cover the accent. Really. – egreg Jul 17 '13 at 19:18
• @egreg Just tried that but I don't like the result; the accent gets above the fence and at the same time the fence is already unnecessarily extended slightly below the theta (as in the second case illustrated above) – niels Jul 17 '13 at 19:32
• all fences are designed to be vertically symmetrical about the math axis. this assures that their appearance will be uniform, no matter what is placed between them. the \theta just happens to be tall, and has no descender. – barbara beeton Jul 17 '13 at 19:40
• @barbarabeeton very interesting indeed! I hadn't noticed that it was only about \theta... Maybe patching \theta could somehow solve my problem? – niels Jul 17 '13 at 20:02
• @niels What about \lvert f(\hat{\theta})\rvert (by the way it's better to use these command provided by amsmath)? The common way is to draw the fences symmetric with respect to the math axis because characters happen to have ascenders and descenders. Lowering theta or raising the fences in your example is not a good answer. Besides, it's really a bad habit having \left and \right in front of each delimiter, whatever TeXnicCenter or WinEdt think about this. – egreg Jul 17 '13 at 20:05

## 4 Answers

As barbara says in her comment,

all fences are designed to be vertically symmetrical about the math axis. this assures that their appearance will be uniform, no matter what is placed between them

I add that using \left and \right in front of all fences is wrong. The case you present shows why. Let's do some experiment. You find nice Francis's solution. Well, it isn't:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\left|\vcenter{\hbox{$$\displaystyle\tilde{\theta}$$}}\right|=\theta+1$
\end{document}

Oh, no! It's awful! OK, we'll raise the thing:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$|x|+\raisebox{\depth}{\left|\vcenter{\hbox{$$\displaystyle\tilde{\theta}$$}}\right|} =\theta+1$
\end{document}

Pezo el tacon del buzo, we say in my region; literally “the patch is worse than the hole”. Or ”the remedy is worse than the disease”.

Compare with the ”correct” version:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\lvert x\rvert+\lvert\tilde{\theta}\rvert=\theta+1$
\end{document}

That's it. It may not please your eyes, but it's really the only way to do. Any increase of the fences' size will be in both direction, because symmetry is much more important than anything else, for fences: no formula can be considered only on its own, but in context: there is text around it, with other formulas.

• @niels To my eyes it's wrong. – egreg Jul 17 '13 at 21:26

The following example explores, how it looks, if the delimiters are shortened.

The delimiters of \left and \right are vertically centered at the math axis. (For example, the minus sign lies on the math axis.) The delimiters try to cover both the height of the formula above the math axis and the depth below the math axis and is using the maximum of both. If a formula is much higher (e.g. \theta with \tilde), then the delimiters will also delimit empty space below the formula. This is a feature! This way, the delimiters remain their symmetry property, that they are vertically centered at the math axis.

Easy recognizable math axis are important (otherwise complex math formulas would be very hard to decipher or even worse, the math formulas might get ambiguous. However, delimited empty space is a waste of space and does not look to good either. Good typography is finding good compromises.

The following example file opens an option. The math formula is first vertically shifted to center the formula at the math axis. This way, \left and \right would select the smallest sizes for the total height of the formula. Then the formula with the delimiters are moved back:

• The formula keeps the math axis.
• The delimiters are minimized (for \left and \right sizing).
• But the property is gone that the delimiters are centered at the math axis.

The example defines the macro:

\cropdelims[<factor>]\left<left delimiter>{<math formula>}\right<right delimiter
• \mleft and \mright of package mleftright can be used (not much relevant here, because package mleftright deals with the horizontal spacing; just trying to make a perfect implementation).
• The <math formula> must to be enclosed in braces, because it needs to be read as macro argument.
• The <factor> is a float number between 0 and 1 and modifies the amount of the shifting. 0 means, no shifting is done and the result should be the same without \cropdelims. 1 means that the full shifting is applied and the size of the delimiters are minimized. The example below also shows the formulas for the factor 0.5 as "compromise", asymmetrical delimiters with delimited empty space, but not so much as for 0 and 1.
\documentclass{article}

\makeatletter
\newcommand*{\cropdelims}[6][1]{%
% #1: factor
% #2: \left or \mleft
% #3: left delimiter
% #4: formula
% #5: \right or \mright
% #6: right delimiter
\begingroup
% detect \left/\right vs. \mleft/\mright
\setbox\z@=\hbox{%
\thinmuskip=\@ne mu %
\medmuskip=0mu %
\thickmuskip=0mu %
\setbox\tw@=\hbox{$#2#3#5#6\m@th$}%
\kern-\wd\tw@
$#2#3#5#6{}\m@th$%
}%
\ifdim\wd\z@>\z@
\expandafter\mathinner
\else
\expandafter\@firstofone
\fi
{%
\mathopen{}%
% \mathpalette provides the current math style
\mathpalette{\cropdelims@aux{#1}{#2#3}{#5#6}}{#4}%
\mathclose{}%
}%
\endgroup
}
% the shifting is implemented in the following macro:
\newcommand*{\cropdelims@aux}[5]{%
% #1: factor
% #2: left delimiter
% #3: right delimiter
% #4: math style
% #5: formula
\setbox\z@=\hbox{$\m@th#4\vcenter{}$}%
\dimen@=\ht\z@
\setbox\z@=\hbox{$#4#5\m@th$}%
% calculate shift
\dimen@=#1\dimexpr\dimen@-.5\dimexpr\ht\z@-\dp\z@\relax\relax
\raisebox{-\dimen@}{%
$#4#2% \raisebox{\dimen@}{%$#4\mathopen{}#5\mathclose{}\m@th$% }% #3\m@th$%
}%
}
\makeatother

\begin{document}

$\alpha + \left|\tilde{\theta}\right| = \left|\theta\right| + \beta$
$\alpha + \cropdelims[0,5]\left|{\tilde{\theta}}\right| = \cropdelims[0.5]\left|{\theta}\right| + \beta$
$\alpha + \cropdelims\left|{\tilde{\theta}}\right| = \cropdelims\left|{\theta}\right| + \beta$
$\cropdelims[0]\left[{\frac{\sum\limits_{i=1}^n i}{a}}\right] = \cropdelims[0]\left[{\frac{a}{\sum\limits_{i=1}^n i}}\right]$
$\cropdelims[.5]\left[{\frac{\sum\limits_{i=1}^n i}{a}}\right] = \cropdelims[.5]\left[{\frac{a}{\sum\limits_{i=1}^n i}}\right]$
$\cropdelims\left[{\frac{\sum\limits_{i=1}^n i}{a}}\right] = \cropdelims\left[{\frac{a}{\sum\limits_{i=1}^n i}}\right]$

\end{document}

• Thanks! You might want to add \usepackage{mleftright} or the code won't compile. – niels Jul 17 '13 at 21:52
• @niels: Thanks, I have fixed the code, there was a left-over from testing. Package mleftright is not needed. – Heiko Oberdiek Jul 17 '13 at 21:54

You can use \lvert\rvert.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\lvert\tilde{\theta}\rvert$
\end{document}

Not sure if this is what you want, but you can always put tilde outside the parentheses:

$\tilde{\left|\theta\right|}$

So:

EDIT: I found this interesting answer from HERE.

Using

$\left|\vcenter{\hbox{$$\displaystyle\tilde{\theta}$$}}\right|$

will give you

EDIT2: As egreg pointed out, this solution will make your tilded-theta not aligned with other characters:

But at very least, the delimiters are aligned in this case. I guess the point is that you cant eat them all.