# \hfil

Used as the lower-level TeX primitive form of \hfill inside an array-like cell; in MathJax it marks a fill position that later affects the cell's alignment.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Spacing](https://texform.dev/latex/topics/spacing) |
| Packages | base |
| Allowed mode | math |
| Tags | invisible |
| Commonality | low |
| Kind | prefix |

## Syntax

### base

Argument specification: ``

Used as the lower-level TeX primitive form of \hfill inside an array-like cell; in MathJax it marks a fill position that later affects the cell's alignment.

## Examples

```latex
\begin{array}{c}a\hfil\end{array}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Barray%7D%7Bc%7Da%5Chfil%5Cend%7Barray%7D)

## Renderer support

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

## Usage frequency

<0.01% of formulas in the measured corpus contain this entry, rank 220 of 263 entries with frequency data.

## In TeXForm

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

### [base/hfil-to-hfill](https://texform.dev/rules/base/hfil-to-hfill)

Collapse hfil to the canonical hfill command under MathJax spacing semantics.

Level: authoring. Fidelity: render.

```latex
\hfil
```

→

```latex
\hfill
```

```latex
\begin{array}{l}A\hfil B\end{array}
```

→

```latex
\begin{array}{l}A\hfill B\end{array}
```

## Equivalent forms

```latex
\hfill
```

exact. Exact in current MathJax implementation because BaseMappings routes \hfil to the same HFill handler as \hfill, though traditional TeX distinguishes their glue orders.

## See also

- [\\hfill](https://texform.dev/latex/commands/hfill)
- [\\hfilll](https://texform.dev/latex/commands/hfilll)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \begin{array}{cc} a \hfil & b \end{array} | Positive: ctx:in-array | Pass | Fail | Pass |
