# \vectorunit

Used in physics notation to denote a bold unit vector with a hat accent.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Physics: vectors](https://texform.dev/latex/topics/physics-vectors) |
| Packages | physics |
| Allowed mode | math |
| Tags |  |
| Commonality | low |
| Kind | prefix |

## Syntax

### physics

Argument specification: `s m`

Used in physics notation to denote a bold unit vector with a hat accent.

## Examples

```latex
\vectorunit{v}
```

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

```latex
\vectorunit*{v}
```

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

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| physics | full | none | full |

## In TeXForm

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

### Expands to (physics)

```latex
\vectorunit{#1}
```

→

```latex
\hat{\vb{#1}}
```

If the optional star is present, the template parts are joined with '*', so \vectorunit*{#1} reparses as \hat{\vb*{#1}}.

### [physics/vectorunit-to-vu](https://texform.dev/rules/physics/vectorunit-to-vu)

Collapse vectorunit to the short vu helper.

Level: authoring. Fidelity: render.

```latex
\vectorunit{#1}
```

→

```latex
\vu{#1}
```

```latex
\vectorunit{e}_r\cdot\vb{r}=r
```

→

```latex
\vu{e}_r\cdot\vb{r}=r
```

## Equivalent forms

```latex
\hat{\vb{#1}}
```

exact. 

```latex
\hat{\vb*{#1}}
```

exact. Starred form.

```latex
\vu{#1}
```

exact. 

```latex
\vu*{#1}
```

exact. Starred alias form.

## See also

- [\\va](https://texform.dev/latex/commands/va)
- [\\vectorarrow](https://texform.dev/latex/commands/vectorarrow)
- [\\vu](https://texform.dev/latex/commands/vu)

## Test cases

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \vectorunit{a} | Positive: baseline | Pass | Fail | Pass |
| \vectorunit*{a} | Positive: vary:s[0] | Pass | Fail | Pass |
| \vectorunit a | Positive: bare[1] | Pass | Fail | Pass |
