How to write a norm symbol in LaTeX

How to write a norm symbol in LaTeX

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

This article aims to show you a simple way to create a norm symbol in LaTeX.

Coming back to vectors once again, we have the norm of the vectors used in physics and mathematics. And as you probably already know, you need the vertical lines to denote the norm of vectors.

Today you are going to learn how to write these lines to generate the norm of a vector in LaTeX.

Norm Symbol

The norm usually denotes the length of the vectors, but depending on the context can have more or fewer meanings. For example

\begin{center}
$$||\vec{\mathbf{r}}|| \, \lVert\vec{a}\rVert \, \|\vec{b}\|$$
\end{center}


Write Norm Symbol in LaTeX

There are a couple of options to create the symbol in LaTeX, all of them are built-in but can have some limitations. The first option is to use double vertical bars “|”, for example

\begin{center}
$$||\vec{\mathbf{r}}||=\sqrt{x^2+y^2+z^2}$$
\end{center}


The second option is to use the commands \lVert (left) and \rVert (right). Each one of these creates the double vertical bars, what you want to be inside the double bars must be in the middle of the two commands. One variation of this method is to use the command \Vert on both sides. For example

\documentclass{article}
\begin{document}
$$\lVert\vec{ab}\rVert=\sqrt{(b_1-a_1)^2 + (b_2-a_2)^2}$$
$$\Vert \sum_{i=1}^{n}x_{i} \Vert$$
$$\Vert\dfrac{x^2+5x-5}{x+4}\Vert$$
\end{document}


The last option without packages is to use the “command” \|, backslash follow by the vertical bar, for example

\documentclass{article}
\begin{document}
$$\|\dfrac{a}{b}\|\,\|\vec{ab}\|$$
\end{document}


The limitation is clear, the double bars do not size correctly if you have a fraction or the expression has some height. To avoid the limitation you can use two commands right before any of the commands above, the commands are \left and \right, for example

\documentclass{article}
\begin{document}    % \Vert command
$$\left\Vert \sum_{i=1}^{n}\dfrac{x_{i}}{x_{i}+5} \right\Vert$$    % \lVert and \rVert command
$$\left\lVert\dfrac{x^4+7x+3}{x+4}\right\lVert$$    % \| command
$$\left\|\dfrac{a}{b}\right\|$$
\end{document}


Norm with a package

If you think that to write the norm symbol you have to type a lot, you are not alone. Luckily there are some packages that make writing the norm symbol easier, and practical in terms or legibility of the LaTex code and in terms of time saving.

The main package presented is the physics package, the command to the norm symbol is \norm and besides giving you the entire symbol in one call, it also adjusts to the value given as argument. For example

\documentclass{article}
\usepackage{physics}
\begin{document}
\begin{center}
$$\norm{2\int_{0}^{\infty}e^{-x^{2}}dx}\leq 0$$
$$\norm{\dfrac{\lim_{x\to5}x^3+4x^2+6}{x+7}}$$
$$\norm{\sum_{i=0}^{\infty}x_{i}+4}^2$$
\end{center}
\end{document}


Which way you approach the norm symbol is up to you, you can first try without the package and then with the package, or search for other packages out there. Remember that LaTeX is to make life easier, not complicated.

I hope this post was helpful to you, and as always keep writing in LaTeX.

LaTex Tutorial on Symbols

Author
Joannah W.
Joannah has been a science publisher with close to 20 years of experience. She wants to help students and researchers stay ahead of the trends and developments in the science community by making science more accessible to everyone.