How to use a bar over one or multiple characters in LaTeX?

In this tutorial, I will show you how to get a bar over a character or multiple characters in LaTeX.

Bar over a single character with \bar

In LaTeX, if you want an overline or bar over a single character then you have to use the \bar{<char>} command. Take a look.

\documentclass{article}
\usepackage{amssymb}
\begin{document}

  $$ \verb|\bar{A}| \rightarrow \bar{A} \quad \checkmark $$
  $$ \verb|\bar{AB}| \rightarrow \bar{AB} \quad \times $$
  $$ \bar{\mathbb{R}} $$
  $$ \bar{\mathbb{Q}} $$

\end{document}

Output:

bar over a single letter.

Bar over multiple characters with \overline

If you want an overline or bar over multiple characters then you can use the \overline{<char>} command.

\documentclass{article}
\usepackage{amssymb}
\begin{document}

  $$ \verb|\overline{A}| \rightarrow \overline{A} \quad \checkmark $$
  $$ \verb|\overline{AB}| \rightarrow \overline{AB} \quad \checkmark $$
  $$ \overline{\mathbb{R}} $$
  $$ \overline{\mathbb{Q}} $$
  $$ \overline{A_1} $$

\end{document}

Output:

overline over multiple characters.

Double Bar over characters in LaTeX

In order to get a double bar over a character or multiple characters you can use the \bar or \overline twice like this.

\bar{\bar{<char>}}

or

\overline{\overline{<char>}}

The recommended command to get a double overline is \overline{\overline{<char>}}.

\documentclass{article}
\usepackage{amssymb}
\begin{document}

  $$ \verb|\bar{\bar{A}}| \rightarrow \bar{\bar{A}} \quad \times $$
  $$ \verb|\overline{\overline{A}}| \rightarrow \overline{\overline{A}} \quad \checkmark $$
  $$ \verb|\overline{\overline{AB}}| \rightarrow \overline{\overline{AB}} \quad \checkmark $$

\end{document}

Output:

double overline.

Leave a Reply

Your email address will not be published. Required fields are marked *