# \tt

Legacy math-mode declaration for switching subsequent symbols in the current group to monospace/typewriter style.

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

## Metadata

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

## Syntax

### base

Argument specification: ``

Legacy math-mode declaration for switching subsequent symbols in the current group to monospace/typewriter style.

### textmacros

Argument specification: ``

Legacy declaration that switches following text to monospaced/typewriter styling until the current group ends.

## Examples

```latex
x \tt y
```

[Open in Playground](https://play.texform.dev/?input=x+%5Ctt+y)

```latex
{x \tt y} z
```

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

```latex
\text{\tt x}
```

[Open in Playground](https://play.texform.dev/?input=%5Ctext%7B%5Ctt+x%7D)

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| base |  | math | Legacy math-mode declaration for switching subsequent symbols in the current group to monospace/typewriter style. |
| textmacros |  | text | Legacy declaration that switches following text to monospaced/typewriter styling until the current group ends. |

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

### Discouraged in base

Legacy declaration-style font switch; modern LaTeX usage prefers scoped commands like \mathtt.

```latex
{\tt $1} -> \mathtt{$1}
```

\mathtt is the modern scoped monospace math alphabet command and avoids the older declaration semantics of \tt.

### Discouraged in textmacros

\tt is an old-style compatibility switch; modern LaTeX prefers NFSS family declarations or text commands.

```latex
{\tt ...} -> {\ttfamily ...}
```

\ttfamily is the LaTeX2e declaration that replaces the deprecated two-letter \tt switch.

```latex
\tt ... -> \texttt{...}
```

\texttt gives explicit scope and is the standard LaTeX2e command for typewriter text.

## Equivalent forms

```latex
\mathtt{#1}
```

approximate. Prefix command alternative for math mode

```latex
\texttt{...}
```

approximate. \texttt is a command with arguments, whereas \tt is declarative.

```latex
{\ttfamily ...}
```

exact. 

## See also

- [\\bf](https://texform.dev/latex/commands/bf)
- [\\cal](https://texform.dev/latex/commands/cal)
- [\\it](https://texform.dev/latex/commands/it)
- [\\mit](https://texform.dev/latex/commands/mit)
- [\\oldstyle](https://texform.dev/latex/commands/oldstyle)
- [\\rm](https://texform.dev/latex/commands/rm)
- [\\sf](https://texform.dev/latex/commands/sf)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| {\tt a} | Positive: baseline | Pass | Pass | Pass |

### textmacros

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| {\tt a} | Positive: baseline | Pass | Pass | Pass |
