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.
Further Reading
LaTex Tutorial on Symbols
- How To Create A Cross Product Symbol In LaTeX
- How to create a hat symbol in LaTeX?
- How to create a prime symbol in LaTeX?
- How to create an absolute value symbol in LaTeX?
- How to create an approximate symbol in LaTeX?
- How to create an intersection symbol in LaTeX?
- How to create the empty set symbol in LaTeX?
- How to write a degree symbol in LaTeX?
- How to write a dot product in LaTeX?
- How to Write a Greater Than Symbol in LaTeX?
- How to write A Plus-Minus Symbol in LaTeX
- How to write a proportional to symbol in LaTeX?
- How to write a real number symbol in LaTeX?
- How to write a tilde symbol in LaTeX?
- How to write a union symbol in LaTeX?
- How to write a vector in LaTeX?
- How to write an infinity symbol in LaTeX?
- How to write bold text in LaTeX?
- How To Write Dots Symbols In LaTeX?
- How to write the arrow symbols in LaTeX
- How to write the Degree celsius symbol in LaTeX?
- How to write the equal or not equal symbol in LaTeX?
- How to write the Euro symbol in LaTeX?
- How to write the floor symbol in LaTeX?
- How to write the gradient operator symbol in LaTeX
- How To Write The Greater Than Or Equal To Symbol In LaTeX?
- How to write the integer number symbol in LaTeX?
- How to write the less than symbol in LaTeX?
- How to write the Natural numbers symbol in LaTeX?
- How to write the parallel symbol in LaTeX?
- How to write the percent symbol in LaTeX?
- How to write the square root symbol in LaTeX?
- How To Write The Symbol For A Subset In LaTeX?
- How to write the symbol for therefore in LaTeX?
- How to write with the mathbb in LaTeX?