#### 4.1.4 `\DeclareTextCommand` & `\ProvideTextCommand`

Synopsis, one of:

```\DeclareTextCommand{cmd}{encoding}{defn}
\DeclareTextCommand{cmd}{encoding}[nargs]{defn}
\DeclareTextCommand{cmd}{encoding}[nargs][optargdefault]{defn}
```

or one of:

```\ProvideTextCommand{cmd}{encoding}{defn}
\ProvideTextCommand{cmd}{encoding}[nargs]{defn}
\ProvideTextCommand{cmd}{encoding}[nargs][optargdefault]{defn}
```

Define the command cmd, which will be specific to one encoding. The command name cmd must begin with a backslash, \. These commands can only appear in the preamble. Redefining `cmd` does not cause an error. The defined command will be robust even if the code in defn is fragile (see \protect).

For example, the file t1enc.def contains this line.

```\DeclareTextCommand{\textperthousand}{T1}{\%\char 24 }
```

With that, you can express parts per thousand.

```\usepackage[T1]{fontenc}  % in preamble
...
Legal limit is \( 0.8 \)\textperthousand.
```

If you change the font encoding to `OT1` then you get an error like ‘LaTeX Error: Command \textperthousand unavailable in encoding OT1’.

The `\ProvideTextCommand` variant does the same, except that it does nothing if cmd is already defined. The `\DeclareTextSymbol` command is faster than this one for simple slot-to-glyph association (see \DeclareTextSymbol)
