# \bar

Used to place an overbar over a symbol or grouped expression, for example for conjugates, closures, or averages.

https://texform.dev/latex/commands/bar

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Accents](https://texform.dev/latex/topics/accents) |
| Packages | base |
| Allowed mode | math |
| Tags | decoration |
| Commonality | high |
| Kind | prefix |

## Syntax

### base

Argument specification: `m`

Used to place an overbar over a symbol or grouped expression, for example for conjugates, closures, or averages.

## Common tasks

### How to put a bar over a single letter

Use \bar for one character; use \overline for a longer run.

```latex
\bar{x}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbar%7Bx%7D)

### How to write a sample mean

```latex
\bar{X}_n = \frac{1}{n}\sum_{i=1}^n X_i
```

[Open in Playground](https://play.texform.dev/?input=%5Cbar%7BX%7D_n+%3D+%5Cfrac%7B1%7D%7Bn%7D%5Csum_%7Bi%3D1%7D%5En+X_i)

### How to stack a bar on a Greek letter

```latex
\bar{\alpha}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbar%7B%5Calpha%7D)

## Examples

```latex
\bar{z}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbar%7Bz%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| base | full | full | full |

## Usage frequency

3.98% of formulas in the measured corpus contain this entry, rank 15 of 263 entries with frequency data.

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

## See also

- [\\acute](https://texform.dev/latex/commands/acute)
- [\\breve](https://texform.dev/latex/commands/breve)
- [\\check](https://texform.dev/latex/commands/check)
- [\\ddddot](https://texform.dev/latex/commands/ddddot)
- [\\dddot](https://texform.dev/latex/commands/dddot)
- [\\ddot](https://texform.dev/latex/commands/ddot)
- [\\dot](https://texform.dev/latex/commands/dot)
- [\\grave](https://texform.dev/latex/commands/grave)
- [\\hat](https://texform.dev/latex/commands/hat)
- [\\mathring](https://texform.dev/latex/commands/mathring)
- [\\tilde](https://texform.dev/latex/commands/tilde)
- [\\vec](https://texform.dev/latex/commands/vec)
- [\\widehat](https://texform.dev/latex/commands/widehat)
- [\\widetilde](https://texform.dev/latex/commands/widetilde)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \bar{a} | Positive: baseline | Pass | Pass | Pass |
| \bar a | Positive: bare[0] | Pass | Pass | Pass |
