# How to write norm which adjusts its size? [duplicate]

I need to write norm of sum, but the sum symbol is larger than tho norm symbol (||) and it doesn't look good. Is there any symbol for norm which will adjust its size?

\documentclass[12pt,a4paper]{article}
\begin{document}
$$||\left(\sum_{n=1}^N \bf P_{\rm n}\rm\right) ||^2 = \left(\sum_n \frac{E_n}{c}\right)^2 - \left(\sum_n \bf p_{\rm n}\rm \right)^2$$
\end{document}

• Please, use \mathbf{P}_{n} and don't use \rm or \bf any more: they have been obsolete for more than ten years in LaTeX. Apr 6, 2013 at 10:22

Either of the following methods should work:

• You could load the amsmath package and define a \norm macro as follows:

\newcommand{\norm}[1]{\left\lVert#1\right\rVert}


and then write

\norm{ \biggl(\sum_{n=1}^N \mathbf{P}_{n}\biggr) }


in the equation of interest. Note that the round parentheses will be too big if you write \left( and \right); I recommend you write \biggl( and \biggr) instead.

Your example code may therefore be written as

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\newcommand\norm[1]{\left\lVert#1\right\rVert}
\begin{document}
$$\norm{ \biggl(\sum_{n=1}^N \mathbf{P}_{n}\biggr) }^2 = \biggl(\sum_n \frac{E_n}{c}\biggr)^2 - \biggl(\sum_n \mathbf{p}_{n} \biggr)^2$$
\end{document}


• Some might say that the resulting norm "fences" in the example above are a bit too large and thus threaten to dominate visually the rest of the math stuff. (This happens, of course, because the macro uses \left and \right directives to size the fences.) To fix this issue, you could load the mathtools package and insert the following instruction in the preamble:

\DeclarePairedDelimiterX{\norm}[1]{\lVert}{\rVert}{#1}


and use the \norm macro with an explicit size instruction (here: \bigg, i.e., the same size as for the parentheses):

\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}
\DeclarePairedDelimiterX{\norm}[1]{\lVert}{\rVert}{#1}
\begin{document}
$$\norm[\bigg]{\biggl(\sum_{n=1}^N \mathbf{P}_{n}\biggr) }^2 = \biggl(\sum_n \frac{E_n}{c}\biggr)^2 - \biggl(\sum_n \mathbf{p}_{n} \biggr)^2$$
\end{document}


• take a look here Apr 6, 2013 at 10:22
• @VincentNivoliers - Note that \Vert is equivalent to \|. The l and r prefixes inform TeX that the commands \lVert and \rVert should be given math codes mathopen and mathclose, respectively. (TeX has no way of knowing how to modify the default math code of \Vert.)
– Mico
Apr 6, 2013 at 10:44
• Any reason why \norm is not pre-defined in amsmath or some other package? It is a quite common operation. Jan 23, 2019 at 14:49
• @Mico - I am sorry, sometimes Latex frustration before a deadline makes me post a useless comment. I use beamer, have a lot of imports and \lVert, \| etc. produces large Pi/product signs. Was hoping someone maybe saw this before and knows which import messes things up. Feb 21, 2022 at 9:17
• @PascalIv - If I replace \documentclass[12pt,a4paper]{article} with \documentclass{beamer}, the document still doesn't produce product symbols instead of summation symbols. All I can surmise is that one or more of the packages you're loading (I have no idea which one it could be... -- cf. my earlier comment) would appear to be messing with the meaning of \sum.
– Mico
Feb 21, 2022 at 12:05

Use \Vert instead of ||. You can prefix \Vert with any brace-sizing-command, like \left, \right, \big, ..

\documentclass[12pt,a4paper]{article}
\begin{document}
$$\left\Vert\left(\sum_{n=1}^N \bf P_{\rm n}\rm\right) \right\Vert^2 = \left(\sum_n \frac{E_n}{c}\right)^2 - \left(\sum_n \bf p_{\rm n}\rm \right)^2$$
\end{document}


• If you want a more 'polished' look for a special case, just look around and search for absolute value. There are many questions here (like this one) which provide additional information, if you want to know more ;) Apr 6, 2013 at 10:15
• All the \rm commands used are wrong: besides being an obsolete command, the n should be in italics. Also \bf is obsolete, use \mathbf{P} and \mathbf{p}. Apr 6, 2013 at 10:16
• @egreg: Suzie wrote the n in E_n in italics, so I think it was a choice to typeset the n in P_n in an upright shape. Apr 6, 2013 at 10:18
• @ralfix According to mathematical conventions, an italic and an upright "n" don't necessarily denote the same object. My feeling is that \rm has been used in order to countermand \bf, but it's wrong to begin with. Apr 6, 2013 at 10:20
• @egreg Thank you, the \mathbf{} is really great. Now my work looks much better :) Apr 6, 2013 at 18:09