How to Write the Mid (∣) Symbol in LaTeX

In LaTeX, you can write the mid symbol (∣) using the \mid command.

The following examples show how to write the mid symbol in LaTeX.

How to Write the Mid Symbol in Text

We can use the \mid command to write the mid symbol in LaTeX document for text.

Suppose we want to write the mid symbol in the text.

We can use the following LaTeX code to do so:

\documentclass{article}
\begin{document}

This is an example of using the mid symbol \( A \mid B \) in a sentence.

\end{document}

Output: 👇️

This is an example of using the mid symbol A ∣ B in a sentence.

In this example, we use the \mid command to display the mid symbol in the text.

How to Write the Mid Symbol in Mathematical Expressions

For mathematical expressions, we can use the \mid command to ensure proper formatting.

Suppose we would like to write mathematical expressions that contain the mid symbol.

We can use the following LaTeX code to do so:

\documentclass{article}
\begin{document}

An inline mathematical expression: \( A \mid B \).

A displayed mathematical expression:
\[
A \mid B
\]

\end{document}

Output: 👇️

Mid Symbol

In this example, we use the \mid command to denote the mid symbol in both inline and displayed mathematical expressions.

Conclusion

We can use the \mid command for both text and mathematical expressions. This ensures that the mid symbol is properly formatted and displayed in your LaTeX document.