The LaTeX command for bar is \bar{x} (overbar / mean).
\bar{x}Writing a paper? The table generator and the BibTeX cleaner are one click away, no account.
| Command | Package | Use it when |
|---|---|---|
\bar{x} recommended | none | Short bar over one letter: the sample mean. |
\overline{AB} | none | Bar over the whole argument: a segment. |
\overline{z + w} | none | Complex conjugate of an expression. |
\={o} | none | Macron in running text. |
Write \bar{x} inside math mode, that is between $…$ for inline math or in a \[ … \] or equation block for display math. It is part of core LaTeX math, so no extra package is required.
$\bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i$Open this example in the live preview: it renders as you type, with no compiler and no signup.
\breve{x}\mathring{x}\widehat{xy}\widetilde{xy}\underline{x}\hat{x}\tilde{x}\overline{x}\overbrace{x}^{n}\underbrace{x}_{n}\vec{x}\dot{x}\ddot{x}\acute{x}Math accents in LaTeX: the full table or search all 350+ LaTeX symbols.
Use \bar{x} in math mode; it needs no extra package. For example, $\bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i$.
None: \bar{x} is built into LaTeX, so no extra package is required.
\bar has a fixed width, so over two or more letters it looks too short: use \overline.