(click anywhere to close)
OPEN MENU

[LaTeX] Math Accents

category: Writing | course: LaTeX Math | difficulty:

It’s already been discussed that you can’t use text within a math environment like you normally would – that’s what makes this math mode special. But, there are certain simple elements you can add to characters (or strings of characters), that change its meaning in a very important way, much like accents do to regular text. For example, adding an arrow above a letter magically turns it into a vector! I like to call these math accents, and this chapter provides all of them, ordered by their type

Real Accents

These look the most like accents you’re used to, and are typically used on a single character, to place something above it. They can be used on multiple characters, but some need their wide counterpart to be able to do so properly. If you use the regular command on multiple characters, it simply places the accent in regular size above it, centred.

Regular Command

Wide Command

Description

\vec{}

\overrightarrow{}

Adds an arrow from left to right

-

\overleftarrow{}

Adds an arrow from right to left

\hat{}

\widehat{}

Adds a hat, or “rooftop”

\tilde{}

\widetilde{}

Adds a tilde, or “wavy line”

\dot{}

-

Adds a single dot

\ddot{}

-

Adds a double dot

\check{}

-

Adds a reverse hat, or check symbol

\breve{}

-

Adds a breve, or “cup”

\acute{}

-

Adds an accent acute

\grave{}

-

Adds an accent grave

\bar{}

-

Adds a bar, or “overline”

Another very important characteristic of these real accents, is that they can be composed; using multiple after each other simply keeps adding the accents above each other.

\begin{gather*}
    \vec{x} - \overrightarrow{xyz} - \overleftarrow{xyz}\\
    \hat{x} - \widehat{xyz}\\
    \tilde{x} - \widetilde{xyz}\\
    \dot{x}\\
    \ddot{x}\\
    \check{x}\\
    \breve{x}\\
    \acute{x}\\
    \grave{x}\\
    \bar{x}
\end{gather*}
LatexMathAccentsOne

One-Argument Commands

These are somewhat like accents, but have no wide counterpart, and can’t all be stacked on top of each other – this ability is only available to overlines and underlines.

Command

Description

\not{}

Slashes diagonally through the character, used mostly for turning an equal sign into a not-equal sign.

\cancel{}

Also slashes diagonally through its argument, but from bottom left to top right. Requires the cancel package.

\overline{}

Adds a line above it

\underline{}

Adds a line underneath it

The first command only accepts single-character arguments.

\usepackage{cancel}

\begin{document}
$\not=  \quad  \cancel{XYZ}  \quad  \overline{XYZ}  \quad  \underline{XYZ}$
\end{document}
LatexMathAccentsTwo

Two-Argument Commands

These accept two arguments of arbitrary length, and place the text from one of the arguments above or below the other. They are automatically centred, and the first two have their brace automatically stretched to the correct length.

Command

Description

\overbrace{arg1}^{arg2}

Places arg2 above arg1, using a brace to group arg1

\underbrace{arg1}_{arg2}

Places arg2 below arg1, using a brace to group arg1

\overset{arg1}{arg2}

Places arg1 above arg2

\underset{arg1}{arg2}

Places arg1 below arg2

\begin{gather*}
    \overbrace{a + \ldots + a}^{n \times a} \\
    \underbrace{a + \ldots + a}_{n \times a} \\
    a \overset{def}{=} b \\
    a \underset{def}{=} b
\end{gather*}
LatexMathAccentsThree
CONTINUE WITH THIS COURSE
Do you like my tutorials?
To keep this site running, donate some motivational food!
Crisps
(€2.00)
Chocolate Milk
(€3.50)
Pizza
(€5.00)