# \hat

Used to place a hat accent over variables, estimators, transforms, and grouped expressions.

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

## 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 a hat accent over variables, estimators, transforms, and grouped expressions.

## Common tasks

### How to put a hat on a variable

```latex
\hat{x}
```

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

### How to write an estimator

```latex
\hat{\theta}_n
```

[Open in Playground](https://play.texform.dev/?input=%5Chat%7B%5Ctheta%7D_n)

### How to hat a longer expression

\hat is for one character; \widehat stretches over several.

```latex
\widehat{AB}
```

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

## Examples

```latex
\hat{i}
```

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

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

## Equivalent forms

```latex
\widehat{#1}
```

approximate. For short bases this is usually similar, but \widehat is intended for wider grouped content.

## See also

- [\\acute](https://texform.dev/latex/commands/acute)
- [\\bar](https://texform.dev/latex/commands/bar)
- [\\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)
- [\\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 |
| --- | --- | --- | --- | --- |
| \hat{a} | Positive: baseline | Pass | Pass | Pass |
| \hat a | Positive: bare[0] | Pass | Pass | Pass |
