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

Encoding definition files

 

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.

The declarations in the encoding definition file are responsible for declaring the encoding and telling LaTeX how to produce characters in this encoding.

The <ENC>enc.def files should contain only commands from this section. 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.


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

The <ENC>enc.def 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 Jul 31 16:42:26 MEST 1997