# W3cubDocs

/LaTeX

#### \DeclareFontEncoding

Synopsis:

```\DeclareFontEncoding{encoding}{text-settings}{math-settings}
```

Declare the font encoding encoding. It also saves the value of encoding in `\LastDeclaredEncoding` (see \LastDeclaredEncoding).

The file t1enc.def contains this line (followed by many others).

```\DeclareFontEncoding{T1}{}{}
```

The text-settings are the commands that LaTeX will run every time it switches from one encoding to another with the `\selectfont` or `\fontencoding` command. The math-settings are the commands that LaTeX will use whenever the font is accessed as a math alphabet.

LaTeX ignores any space characters inside text-settings and math-settings, to prevent unintended spaces in the output.

If you invent an encoding you should pick a two or three letter name starting with ‘L’ for ‘local’, or ‘E’ for ‘experimental’.

Note that output encoding files may be read several times by LaTeX so using, e.g., `\newcommand` may cause an error. In addition, such files should contain `\ProvidesFile` line (see Class and package commands).

Note also that you should use the `\...Default` commands only in a package, not in the encoding definition files, since those files should only contain declarations specific to that encoding.