# \mathchoice

Low-level style-dependent math macros that provide separate display, text, script, and scriptscript forms, typically inside macro definitions or specialized package code.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Fonts and styles](https://texform.dev/latex/topics/fonts-styles) |
| Packages | base |
| Allowed mode | math |
| Tags |  |
| Commonality | low |
| Kind | prefix |

## Syntax

### base

Argument specification: `m m m m`

Low-level style-dependent math macros that provide separate display, text, script, and scriptscript forms, typically inside macro definitions or specialized package code.

## Examples

```latex
\mathchoice a b c d
```

[Open in Playground](https://play.texform.dev/?input=%5Cmathchoice+a+b+c+d)

```latex
\mathchoice{a+b}{a-b}{a}{b}
```

[Open in Playground](https://play.texform.dev/?input=%5Cmathchoice%7Ba%2Bb%7D%7Ba-b%7D%7Ba%7D%7Bb%7D)

## Renderer support

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

## In TeXForm

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

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \mathchoice{a}{b}{c}{d} | Positive: baseline | Pass | Pass | Pass |
| \mathchoice a{b}{c}{d} | Positive: bare[0] | Pass | Pass | Fail |
| \mathchoice{a}b{c}{d} | Positive: bare[1] | Pass | Pass | Fail |
| \mathchoice{a}{b}c{d} | Positive: bare[2] | Pass | Pass | Fail |
| \mathchoice{a}{b}{c}d | Positive: bare[3] | Pass | Pass | Fail |
