next up previous contents
Next: Default definitions Up: Encodings Previous: The fontenc package

Encoding definition file commands

 

Note: An encoding definition file should contain only commands from this subsection.

As with the font definition file commands, it is also possible (although normally not necessary) to use these declarations directly within a class or package file.

Warning: Some aspects of the contents of font definition files are still under development. Therefore, the current versions of the files ot1enc.def and t1enc.def are temporary versions and should not be used as models for producing further such files. For further information you should read the documentation in ltoutenc.dtx.


\ProvidesFile{<file-name>}[<release-info>]

The file should announce itself with a \ProvidesFile command, described in LaTeX2e for Class and Package Writers. For example:

   \ProvidesFile{ot2enc.def}
                [1994/06/01 Washington University Cyrillic encoding]


\DeclareFontEncoding {<encoding>} {<text-settings>} {<math-settings>}

Declares a new encoding scheme <encoding>.

The <text-settings> are declarations which are executed every time \selectfont changes the encoding to be <encoding>.

The <math-settings> are similar but are for math alphabets. They are executed whenever a math alphabet with this encoding is called.

Spaces within the arguments are ignored to avoid surplus spaces in the document. If a real space is necessary use \space.

Example:

   \DeclareFontEncoding{OT1}{}{}

Some author commands need to change their definition depending on which encoding is currently in use. For example, in the OT1 encoding, the letter `Æ' is in slot "1D, whereas in the T1 encoding it is in slot "C6. So the definition of \AE has to change depending on whether the current encoding is OT1 or T1. The following commands allow this to happen.


\DeclareTextCommand {<cmd>} {<encoding>} [<num>] [<default>] {<definition>}

This command is like \newcommand, except that it defines a command which is specific to one encoding. For example, the definition of \k in the T1 encoding is:

  \DeclareTextCommand{\k}{T1}[1]
     {\oalign{\null#1\crcr\hidewidth\char12}}
\DeclareTextCommands takes the same optional arguments as \newcommand.

The resulting command is robust, even if the code in <definition> is fragile.

It does not produce an error if the command has already been defined but logs the redefinition in the transcript file.


\ProvideTextCommand {<cmd>} {<encoding>} [<num>] [<default>] {<definition>}

This command is the same as \DeclareTextCommand, except that if <cmd> is already defined in encoding <encoding>, then the definition is ignored.


\DeclareTextSymbol {<cmd>} {<encoding>} {<slot>}

This command defines a text symbol with slot <slot> in the encoding. For example, the definition of \ss in the OT1 encoding is:

   \DeclareTextSymbol{\ss}{OT1}{25}
It does not produce an error if the command has already been defined but logs the redefinition in the transcript file.


\DeclareTextAccent {<cmd>} {<encoding>} {<slot>}

This command declares a text accent, with the accent taken from slot <slot> in the encoding. For example, the definition of \" in the OT1 encoding is:

   \DeclareTextAccent{\"}{OT1}{127}
It does not produce an error if the command has already been defined but logs the redefinition in the transcript file.


\DeclareTextComposite {<cmd>} {<encoding>} {<letter>} {<slot>}

This command declares that the composite letter formed from applying <cmd> to <letter> is defined to be simply slot <slot> in the encoding. The <letter> should be a single letter (such as a) or a single command (such as \i).

For example, the definition of \'{a} in the T1 encoding could be declared like this:

   \DeclareTextComposite{\'}{T1}{a}{225}

The <cmd> will normally have been previously declared for this encoding, either by using \DeclareTextAccent, or as a one-argument \DeclareTextCommand.


\DeclareTextCompositeCommand {<cmd>} {<encoding>} {<letter>} {<definition>}

This is a more general form of \DeclareTextComposite, which allows for an arbitrary <definition>, not just a <slot>. The main use for this is to allow accents on i to act like accents on \i, for example:

   \DeclareTextCompositeCommand{\'}{OT1}{i}{\'\i}
It has the same restrictions as \DeclareTextComposite.


next up previous contents
Next: Default definitions Up: Encodings Previous: The fontenc package

Rainer Schoepf
Thu Jan 8 11:52:24 MET 1998