Next: Encoding defaults Up: Encodings Previous: Encoding definition file commands

## Default definitions

The declarations used in encoding definition files define encoding-specific commands but they do not allow those commands to be used without explicitly changing the encoding. For some commands, such as symbols, this is not enough. For example, the `OMS` encoding contains the symbol `§', but we need to be able to use the command `\S` whatever the current encoding may be, without explicitly selecting the encoding `OMS`. To allow this, LATEX has commands that declare default definitions for commands; these defaults are used when the command is not defined in the current encoding. For example, the default encoding for `\S` is `OMS`, and so in an encoding (such as `OT1`) which does not contain `\S`, the `OMS` encoding is selected in order to access this glyph. But in an encoding (such as `T1`) which does contain `\S`, the glyph in that encoding is used. The standard LATEX2e format sets up several such defaults using the following encodings: `OT1`, `OMS` and `OML`.

Warning: These commands should not occur in encoding definition files, since those files should declare only commands for use when that encoding has been selected. They should instead be placed in packages; they must, of course, always refer to encodings that are known to be available.

`\DeclareTextCommandDefault` `{`<cmd>`}` `{`<definition>`}`

This command allows an encoding-specific command to be given a default definition. For example, the default definition for `\copyright` is defined be be a circled `c' with:

       \DeclareTextCommandDefault{\copyright}{\textcircled{c}}

`\DeclareTextAccentDefault` `{`<cmd>`}` `{`<encoding>`}`
`\DeclareTextSymbolDefault` `{`<cmd>`}` `{`<encoding>`}`

These commands allow an encoding-specific command to be given a default encoding. For example, the default encoding for `\"` and `\ae` is set to be `OT1` by:

       \DeclareTextAccentDefault{\"}{OT1}
       \DeclareTextSymbolDefault{\ae}{OT1}

Note that `\DeclareTextAccentDefault` can be used on any one-argument encoding-specific command, not just those defined with `\DeclareTextAccent`. Similarly, `\DeclareTextSymbolDefault` can be used on any encoding-specific command with no arguments, not just those defined with `\DeclareTextSymbol`. For more examples of these definitions, see `ltoutenc.dtx`.

`\ProvideTextCommandDefault` `{`<cmd>`}` `{`<definition>`}`

This command is the same as `\DeclareTextCommandDefault`, except that if the command already has a default definition, then the definition is ignored. This is useful to give `faked' definitions of symbols which may be given `real' definitions by other packages. For example, a package might give a fake definition of `\textonequarter` by saying:

       \ProvideTextCommandDefault{\textonequarter}{$\m@th\frac14$}

Next: Encoding defaults Up: Encodings Previous: Encoding definition file commands