# \sf

Legacy math-mode declaration for switching subsequent symbols in the current group to sans-serif.

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

## 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 sans-serif.

### textmacros

Argument specification: ``

Legacy declaration that switches following text to sans-serif styling until the current group ends.

## Examples

```latex
x \sf y
```

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

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

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

```latex
\text{\sf x}
```

[Open in Playground](https://play.texform.dev/?input=%5Ctext%7B%5Csf+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 sans-serif. |
| textmacros |  | text | Legacy declaration that switches following text to sans-serif styling until the current group ends. |

## Renderer support

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

## Usage frequency

0.19% of formulas in the measured corpus contain this entry, rank 90 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 prefers the argument-scoped form \mathsf.

```latex
{\sf $1} -> \mathsf{$1}
```

\mathsf is the standard scoped sans-serif math alphabet command and avoids legacy declaration-style scope.

### Discouraged in textmacros

\sf is a deprecated old-style font-family switch; LaTeX2e recommends NFSS declarations or scoped text commands.

```latex
{\sf ...} -> {\sffamily ...}
```

\sffamily is the LaTeX2e family declaration that supersedes the deprecated \sf switch.

```latex
\sf ... -> \textsf{...}
```

\textsf gives explicit scope and is the standard LaTeX2e command for sans-serif text.

## Equivalent forms

```latex
\mathsf{#1}
```

approximate. Prefix command alternative for math mode

```latex
\textsf{...}
```

approximate. \textsf is a command with arguments, whereas \sf is declarative.

```latex
{\sffamily ...}
```

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)
- [\\tt](https://texform.dev/latex/commands/tt)

## Test cases

### base

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

### textmacros

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