7

In my preamble I have the following

\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\makeatletter
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother

without really knowing how it works. But it does work great in most cases. But the following looks really bad

\norm{a} - \norm{b_{t|t}}

because the sizes of the delimiters are different. I therefore want to control their size manually, as in \big, \Big, etc...

Anybody know a smart way?

10
  • \norm[\big]{…}, for instance.
    – Bernard
    Aug 12 '14 at 21:24
  • @DavidCarlisle From what I can tell by commenting it out, that seems to be what takes care of the automatic resizing.
    – Patrick
    Aug 12 '14 at 21:29
  • @Bernard Tried, didn't work
    – Patrick
    Aug 12 '14 at 21:29
  • @Patrick no, you define \norm then you save that definition as \oldnorm then you define \norm to be oldnorm so get back to where you were. Aug 12 '14 at 21:31
  • 1
    @Patrick: Sorry, I didn't notice you interverted \norm and \norm*: it's \norm*[\big]{…} you have to write.
    – Bernard
    Aug 12 '14 at 21:38
5

This is a good example why I usually discourage using \left and \right indiscriminately.

With \DeclarePairedDelimiter\norm{\lVert}{\rVert} you are defining the macro \norm that can be used in the following ways:

\norm{x}
\norm[\big]{x}
\norm[\Big]{x}
\norm[\bigg]{x}
\norm[\Bigg]{x}
\norm*{x}

The simple call does nothing to the size of the delimiters, the following ones with the optional argument specify the size “manually”, the last one tells TeX to use “automatic” sizing.

The trick you're using tells TeX that if you call \norm{x}, \oldnorm*{x} is executed and, when \norm*{x} is found, \oldnorm{x} is actually executed.

Here's how you could do it:

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\makeatletter
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother

\begin{document}

(1) $\norm{a} - \norm{b_{t|t}}$

\bigskip

(2) $\norm*[\big]{a} - \norm*[\big]{b_{t|t}}$

\bigskip

(3) $\norm*{a} - \norm*{b_{t|t}}$

\end{document}

enter image description here

I have no doubt whatsoever that (3) is the only correct way. The trick you're using with \oldnorm is simply useless: just remove it and type

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter\norm{\lVert}{\rVert}%

\begin{document}

(3) $\norm{a} - \norm{b_{t|t}}$

\end{document}

using the optional argument or the *-form only when they are really necessary.

This input will give the form (3) above.

3
  • My personal taste would make me choose version 2: version 3 seems too small when you have letters with ascenders or descenders — not to speak of subscripts, and I think that within one expression, all \Verts should have, as much as is reasonable, the same height.
    – Bernard
    Aug 12 '14 at 21:57
  • They have the same height; the version with \big around a would also need some horizontal space.
    – egreg
    Aug 12 '14 at 22:06
  • I agree they have the same height. Maybe adding .5mu on both sides with \big would be necessary indeed. But my opinion is that it should be \big by default: this is the most common case.
    – Bernard
    Aug 12 '14 at 22:09

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.