When writing mathematical expressions in LaTeX, users often need to place a line above variables. This is commonly used to represent averages, complex conjugates, or other mathematical notation.

However, using the same command for every situation does not always produce the correct result.

A single variable usually needs a short line, while longer expressions require a command that automatically stretches across the entire expression.

When Should You Use the \bar Command

The \bar{} command places a short line above a symbol.

It works best when the argument contains only one character. Because the line is short, it fits naturally over small variables in mathematical expressions.

\bar{symbol}
\documentclass{article}
\begin{document}
  \[ r=\sqrt{z\bar{z}} \]
  \[ e^{i\theta}=\frac{\ln z-\ln \bar{z}}{2i} \]
  \[ \psi(z)=\psi(\bar{z}) \]
\end{document}

This command is mainly used for small variables in equations. If the expression becomes longer, the line may not cover the entire content correctly.

Using \overline for Longer Expressions

When the expression contains more than one character, the \overline{} command is a better choice. It stretches automatically to match the width of the content placed inside it.

\overline{expression}
\documentclass{article}
\begin{document}
  \[ \overline{zw} = \bar{z}\,\bar{w} \]
  \[ \overline{\frac{z}{w}}=\frac{\bar{z}}{\overline{w}} \]
\end{document}

Because the line expands automatically, this command is ideal for formulas, fractions, and grouped expressions.

Creating a Double Overline in Equation

Sometimes mathematical notation requires two lines above a variable or expression. In such situations, the command can simply be applied twice.

\[\overline{\overline{a+ib}} = \overline{a-ib}\]

This technique is often used in mathematical proofs or complex number notation where a repeated operation must be shown.

FAQs

How do you put a line above a letter in LaTeX?

You can place a line above a letter in LaTeX using the \bar or \overline command. The \bar command is commonly used for a single character, while \overline is better for longer expressions.

What is the difference between \bar and \overline in LaTeX?

The \bar command places a short line above a single symbol, such as \bar{x}. The \overline command stretches across multiple characters, making it more suitable for expressions like \overline{z+w}.

Can I use \bar for multiple characters in LaTeX?

Although \bar can technically take multiple characters as an argument, it usually produces a short line that does not cover the entire expression. For multiple characters or longer formulas, \overline is generally preferred.

How do you write a double overline in LaTeX?

A double overline can be created by applying the \overline command twice.

Best Practice

Use \bar{} for short variables such as x, y, or z.
Use \overline{} whenever the expression contains multiple characters, operators, or fractions.

Share tutorial

Jidan Physics Educator and LaTeX Specialist at PhysicsRead

Jidan

LaTeX enthusiast and physics educator who enjoys explaining mathematical typesetting and scientific writing in a simple way. Writes tutorials to help students and beginners understand LaTeX more easily.

Leave a Comment

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