# \framebox

Used to place text or math inside a framed box, optionally specifying the width and horizontal alignment.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Boxes and text](https://texform.dev/latex/topics/boxes-text) |
| Packages | base |
| Allowed mode | math |
| Tags | presentation |
| Commonality | medium |
| Kind | prefix |

## Syntax

### base

Argument specification: `o:L o:N m:T`

Used to place text or math inside a framed box, optionally specifying the width and horizontal alignment.

## Examples

```latex
\framebox{x+y}
```

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

```latex
\framebox[100pt]{x+y}
```

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

```latex
\framebox[100pt][c]{x+y}
```

[Open in Playground](https://play.texform.dev/?input=%5Cframebox%5B100pt%5D%5Bc%5D%7Bx%2By%7D)

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

## Equivalent forms

```latex
\fbox{#1}
```

approximate. \fbox does not take optional arguments for width and alignment

```latex
\boxed{#1}
```

exact. \boxed is typically for math mode, while \framebox acts more like \text but can parse math internally.

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \framebox{a} | Positive: baseline | Pass | Fail | Pass |
| \framebox[1pt]{b} | Positive: vary:o[0] | Pass | Fail | Pass |
| \framebox[a]{b} | Positive: vary:o[1] | Pass | Fail | Fail |
| \framebox[1pt][b]{c} | Positive: maximal | Pass | Fail | Pass |
| \framebox a | Positive: bare[2] | Pass | Fail | Pass |
| \framebox[a]{a} | Negative: neg:L[0] | Pass | Fail | Fail |
| \framebox[\alpha]{a} | Negative: neg:N[1] | Pass | Fail | Fail |
| \framebox{a^2} | Negative: neg:T[2] | Pass | Fail | Fail |
