# How to Write Double Vertical Bars (||) in LaTeX

In LaTeX, you can write double vertical bars using the `||`

command for text and mathematical expressions.

Alternatively, you can use the `\lVert`

and `\rVert`

commands, which are often preferred for denoting norms or absolute values in mathematical expressions.

The following examples show how to write double vertical bars in LaTeX.

## How to Write Double Vertical Bars in Text

We can directly use the `||`

command in LaTeX document for text.

### Example: Double Vertical Bars in Text

Suppose we want to write double vertical bars in the text.

We can use the following LaTeX code to do so:

```
\documentclass{article}
\begin{document}
This is an example of using double vertical bars ||like this|| in a sentence.
\end{document}
```

Output: 👇️

```
This is an example of using double vertical bars ||like this|| in a sentence.
```

In this example, we use the double vertical bars are used to enclose a part of the sentence.

## How to Write Double Vertical Bars in Mathematical Expressions

For mathematical expressions, We can use the `||`

command or the `\lVert`

and `\rVert`

commands to ensure proper formatting. You will need to include the amsmath package in LaTeX document, which defines these commands.

### Example: Double Vertical Bars in Mathematical Expressions

Suppose we would like to write mathematical expressions that contain double vertical bars.

We can use the following LaTeX code to do so:

```
\documentclass{article}
\begin{document}
An inline mathematical expression: \( \lVert a + b \rVert \).
A displayed mathematical expression:
\[
\left\lVert \frac{a}{b} \right\rVert + \left\lVert \frac{c}{d} \right\rVert
\]
\end{document}
```

Output: 👇️

In this example, we use the `\lVert`

and `\rVert`

commands to enclose elements in a norm or absolute value. The `\left\lVert`

and `\right\lVert`

commands are used to adjust the size of the double vertical bars to fit the enclosed fractions.

## Conclusion

We can use the `||`

command for both text and mathematical expressions. For larger expressions, `\left\lVert`

and `\right\lVert`

commands help in adjusting the size of the double vertical bars automatically.