ltoutenc.dtx

Johannes Braams  David Carlisle  Alan Jeffrey
Frank Mittelbach  Chris Rowley  Rainer Schöpf

1995/12/11

1 Font encodings

This section of the kernel contains commands for declaring encoding-specific commands, such as accents. It also contains the code for the OMLenc.def, OMSenc.def, T1enc.def and OT1enc.def files, which define the OLM, OMS, T1 and OT1 encodings, and the fontenc package for selecting encodings.

The fontenc package has options for encodings, of which the last option is the default encoding. For example, to use the OT2, OT3 and T1 encodings, with T1 as the default, you say:

    \usepackage[OT2,OT3,T1]{fontenc}

The syntax for declaring encoding-specific commands is:

     \DeclareTextCommand{⟨command⟩}{⟨encoding⟩}

[⟨number⟩][⟨default⟩]{⟨commands⟩}

This command is like \newcommand, except that it defines a command which is specific to one encoding. The resulting command is always robust, even if its definition is fragile. For example, the definition of \aa in the OT1 encoding is:

    \DeclareTextCommand{\aa}{OT1}{{\accent23a}}

\DeclareTextCommand takes the same optional arguments as \newcommand.

     \ProvideTextCommand{⟨command⟩}{⟨encoding⟩}

[⟨number⟩][⟨default⟩]{⟨commands⟩}

This acts like \DeclareTextCommand, but does nothing if the command is already defined.

\DeclareTextSymbol{⟨command⟩}{⟨encoding⟩}{⟨slot⟩}

This command defines a text symbol, with a particular slot in that encoding. The commands:

    \DeclareTextSymbol{\ss}{OT1}{25}
    \DeclareTextCommand{\ss}{OT1}{{\char25}}

have the same effect, but the \DeclareTextSymbol is faster.

\DeclareTextAccent{⟨command⟩}{⟨encoding⟩}{⟨slot⟩} This command declares a text accent. The commands:

    \DeclareTextAccent{\"}{OT1}{127}
    \DeclareTextCommand{\"}{OT1}[1]{{\accent127#1}}

have the same effect.

     \DeclareTextComposite{⟨command⟩}{⟨encoding⟩}{⟨slot⟩}

This command declares a composite letter, for example in the T1 encoding \'{a} is slot 225, which is declared by:

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

The command should have been declared with \DeclareTextAccent, or as a one-

argument \DeclareTextCommand.

\DeclareTextComposite is the most common example of using the declaration \DeclareTextCompositeCommand, which can define a composite to be an arbitrary piece of text.

     \DeclareTextCompositeCommand{⟨command⟩}{⟨encoding⟩}{⟨text⟩}

For example, you can declare that \'i is the same as \'\i by saying:

    \DeclareTextCompositeCommand{\'}{OT1}{i}{\'\i}

The command should have been declared with \DeclareTextAccent, or as a one-

argument \DeclareTextCommand.

The commands defined using the above commands can be used in two ways. Normally they can used by just calling the command in the appropriate encoding, for example \ss. However, sometimes you may wish to use a command in an encoding where it is not defined. If the command has no arguments, then you can use it in another encoding by calling \UseTextSymbol:

\UseTextSymbol{⟨encoding⟩}{⟨command⟩} For example, \UseTextSymbol{\ss}{OT1} has the same effect as:

    {\fontencoding{OT1}\selectfont\ss}

If the command has one argument then you can use it in another encoding by

calling \UseTextAccent:

\UseTextAccent{⟨encoding⟩}{⟨command⟩}{⟨text⟩} For example, if the current encoding is OT2 then \UseTextAccent{OT1}{\'}{a} has the same effect as:

    {\fontencoding{OT1}\selectfont\'{\fontencoding{OT2}\selectfont a}}

You can also declare a default definition for a text command, which will be used if the current encoding has no appropriate definition.

     \DeclareTextCommandDefault{⟨command⟩}{⟨definition⟩}

For example, the default definition of the command \textonequarter (which produces the fraction \frac{1}{4}) is built using math mode:

    \DeclareTextCommandDefault{\textonequarter}{$\frac14$}

There is a matching \Provide command which will not override an existing default definition:

     \ProvideTextCommandDefault{⟨command⟩}{⟨definition⟩}

The most common use for these commands is to use symbols from other encodings, so there are some optimizations provided:

     \DeclareTextSymbolDefault{⟨command⟩}⟨encoding⟩}
     \DeclareTextAccentDefault{⟨command⟩}⟨encoding⟩}

are short for:

     \DeclareTextCommandDefault{⟨command⟩}
                         {\UseTextSymbol{⟨encoding⟩}{⟨command⟩}}
     \DeclareTextCommandDefault[1]{⟨command⟩}
                     {\UseTextAccent{⟨encoding⟩}{⟨command⟩}{#1}}

For example, to make OT1 the default encoding for \ss and \' you say:

    \DeclareTextSymbolDefault{\ss}{OT1}
    \DeclareTextAccentDefault{\'}{OT1}

Note that you can use these commands on any zero- or one-argument commands declared with \DeclareText* or \ProvideText*, not just those defined using

\DeclareTextSymbol or \DeclareTextAccent.

1.1 Docstrip modules

This .dtx file is be used to generate several related files containing font encoding definitions. The mutually exculsive docstrip options are:

T1  generates T1enc.def for the Cork encoding,
OT1  generates OT1enc.def for Knuth’s CM encoding,
OMS  generates OMSenc.def for Knuth’s math symbol encoding,
OML  generates OMLenc.def for Knuth’s math letters encoding,
package generates fontenc.sty for selecting encodings,
2ekernel for the kernel commands.
autoload for the ‘autoload’ kernel commands.
autoerr for autoerr.sty error message autoload file

1.2 Definitions for the kernel

1.2.1 Declaration commands

This section contains definitions for commands such as accents which depend on the current encoding. These commands will usually be kept in .def files, for example OT1enc.def contains the definitions for the OT1 encoding.

1 ⟨∗2ekernel | autoload⟩

 2 \message{font encodings,}
\DeclareTextCommand \ProvideTextCommand \DeclareTextSymbol \@dec@text@cmd \@changed@cmd \@changed@x \TextSymbolUnavailable \@inmathwarn If you say:
    \DeclareTextCommand{\foo}{T1}...

then \foo is defined to be \T1-cmd \foo \T1\foo, where \T1\foo is one control sequence, not two! We then call \newcommand to define \T1\foo.

 3 \def\DeclareTextCommand{%
 4 \@dec@text@cmd\newcommand
 5 }
 6 \def\ProvideTextCommand{%
 7 \@dec@text@cmd\providecommand
 8 }
 9 \def\DeclareTextSymbol#1#2#3{%
10 \@dec@text@cmd\chardef#1{#2}#3\relax

11 }

12 \def\@dec@text@cmd#1#2#3{%
13 \expandafter\def\expandafter#2%
14  \expandafter{%
15  \csname#3-cmd\expandafter\endcsname
16  \expandafter#2%
17  \csname#3\string#2\endcsname
18  }%
19 \let\@ifdefinable\@rc@ifdefinable
20 \expandafter#1\csname#3\string#2\endcsname

21 }

The declarations are only available before \begin{document}.

22 \@onlypreamble\DeclareTextCommand
23 \@onlypreamble\DeclareTextSymbol

The sneaky bit in all this is what \T1-cmd \foo \T1\foo does. There’s five possibilities, depending on the current values of \protect, \cf@encoding and

\ifmmode:
   • If \protect is \@typeset@protect and \cf@encoding is T1, then we execute

\T1\foo. This should be the normal behaviour, and is optimized for speed.

   • If \protect is \@typeset@protect, \cf@encoding is (say) OT1, and

\OT1\foo is defined, then we execute \OT1\foo.

   • If \protect is \@typeset@protect, \cf@encoding is (say) OT1, we’re in

text mode, and \OT1\foo is undefined, then we define \OT1\foo to be the default value of \foo, and execute \OT1\foo.

• If \protect is \@typeset@protect, \cf@encoding is (say) OT1, we’re in

math mode, and \OT1\foo is undefined, then we execute the default value of \foo. (This is necessary so that things like $X_\copyright$ work properly.)

• If \protect is not \@typeset@protect then we execute \noexpand\foo.

For example, if we are writing to a file, then this results in \foo being written. If we are in a \mark, then \foo will be put in the mark—since \foo is robust, it will then survive all the things which may happen to it whilst it’s a \mark.

So after all that, we will either execute the appropriate definition of \foo for the current encoding, or we will execute \noexpand\foo.

The default value of \foo is \?\foo if it is defined, and an error message otherwise.

When the encoding is changed from T1 to OT1, \T1-cmd is defined to be

\@changed@cmd and \OT1-cmd is defined to be \@current@cmd. This means that

the test for what the current encoding is can be performed quickly.

24 \def\@current@cmd#1{%
25 \ifx\protect\@typeset@protect
26  \@inmathwarn#1%
27 \else
28  \noexpand#1\expandafter\@gobble
29 \fi

30 }

31 \def\@changed@cmd#1#2{%
32 \ifx\protect\@typeset@protect
33  \@inmathwarn#1%
34  \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
35  \expandafter\ifx\csname ?\string#1\endcsname\relax
36  \expandafter\def\csname ?\string#1\endcsname{%
37  \TextSymbolUnavailable#1%
38  }%
39  \fi
40  \global\expandafter\let
41  \csname\cf@encoding \string#1\expandafter\endcsname
42  \csname ?\string#1\endcsname
43  \fi
44  \csname\cf@encoding\string#1%
45  \expandafter\endcsname
46 \else
47  \noexpand#1%
48 \fi

49 }

50 ⟨/2ekernel | autoload⟩ 51 ⟨∗2ekernel | autoerr⟩

52 \gdef\TextSymbolUnavailable#1{%
53 \@latex@error{%
54  Command \protect#1 unavailable in encoding \cf@encoding%
55 }\@eha

57 ⟨/2ekernel | autoerr⟩

58 ⟨autoload⟩\gdef\TextSymbolUnavailable{\@autoerr\TextSymbolUnavailable}

59 ⟨∗2ekernel | autoload⟩

The command \@inmathwarn produces a warning message if we are currently in math mode. Note that since this command is used inside text commands, it can’t call \relax before the \ifmmode. This means that it is possible for the warning to fail to be issued at the beginning of a row of an halign whose template enters math mode. This is probably a bad feature, but there’s not much that can be done about it, since adding a \relax would break ligatures and kerning between text symbols.

A more efficient solution would be to make \@inmathwarn and \@inmatherr equal to \@empty and \relax by default, and to have \everymath reset them to their usual definitions. This is left for future investigation (for example it may break some third party code).

60 \def\@inmathwarn#1{%
61 \ifmmode
62  \@latex@warning{Command \protect#1 invalid in math mode}%
63 \fi

64 }

\DeclareTextCommandDefault \ProvideTextCommandDefault These define commands with encoding ?.

Note that \DeclareTextCommandDefault can only be used in the preamble, but that the \Provide version is allowed in inputenc .def files, so is allowed anywhere.

65 \def\DeclareTextCommandDefault#1{%
66 \DeclareTextCommand#1?%

67 }

68 \def\ProvideTextCommandDefault#1{%
69 \ProvideTextCommand#1?%

70 }

71 \@onlypreamble\DeclareTextCommandDefault
72 %\@onlypreamble\ProvideTextCommandDefault

They require \?-cmd to be initialized as \@changed@cmd.

73 \expandafter\let\csname?-cmd\endcsname\@changed@cmd

\DeclareTextAccent This is just a disguise for defining a TEX \accent command.

74 \def\DeclareTextAccent#1#2#3{%
75 \DeclareTextCommand#1{#2}[1]{{\accent#3 ##1}}

76 }

77 \@onlypreamble\DeclareTextAccent
\DeclareTextCompositeCommand \DeclareTextComposite \@text@composite \@text@composite@x \@strip@args Another amusing game to play with \expandafter, \csname, and \string.
   When you say \DeclareTextCompositeCommand{\foo}{T1}{a}{bar}, we first

check to make sure that \T1\foo is a one-argument macro, by making sure that its \meaning begins macro:#1-, and call an error if it isn’t. Assuming all’s well, we look to see if the expansion of \T1\foo begins with \@text@composite, and if it doesn’t, we redefine \T1\foo to be:

    #1 -> \@text@composite \T1\foo #1\@empty \@text@composite {...}

where ... is the previous definition of \T1\foo. Finally, we define \\T1\foo-a to expand to bar.

78 \def\DeclareTextCompositeCommand#1#2#3#4{%
79 \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
80 \edef\reserved@b{\string##1}%
81 \edef\reserved@c{%
82  \expandafter\@strip@args\meaning\reserved@a:-\@strip@args}%
83 \ifx\reserved@b\reserved@c
84  \expandafter\expandafter\expandafter\ifx
85  \expandafter\@car\reserved@a\relax\relax\@nil
86  \@text@composite
87  \else
88  \edef\reserved@b##1{%
89  \def\expandafter\noexpand
90  \csname#2\string#1\endcsname####1{%
91  \noexpand\@text@composite
92  \expandafter\noexpand\csname#2\string#1\endcsname
93  ####1\noexpand\@empty\noexpand\@text@composite
94  {##1}%
95  }%
96  }%
97  \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
98  \fi
99  \expandafter\def\csname\expandafter\string\csname
100  #2\endcsname\string#1-\string#3\endcsname{#4}%
101 \else
102  \@latex@error{%
103  \string\DeclareTextCompositeCommand\space used on
104  inappropriate command \protect#1%
105  }\@eha
106 \fi

107 }

108 \@onlypreamble\DeclareTextCompositeCommand

This all works because:

    \@text@composite \T1\foo A\@empty \@text@composite {...}

expands to \\T1\foo-A if \\T1\foo-A has been defined, and {...} otherwise.

Note that \@text@composite grabs the first token of the argument and puts just that in the csname. This is so that \'{\textit{e}} will work—it checks whether \\T1\'-\textit is defined (which presumbaly it isn’t) and so expands

to {\accent 1 \textit{e}}.

This trick won’t always work, for example \'{{\itshape e}} will expand to (with spaces added for clarity):

    \csname \string \T1\' - \string {\itshape e} \@empty \endcsname

which will die pretty horribly. Unfortunately there’s not much can be done about this if we’re going to use \csname lookups as a fast way of accessing composites.

This has an unfortunate ‘malfeature’ though, which is that in the T1 encoding, \'{aa} produces á. This is not the expected behaviour, and should perhaps be fixed if the fix doesn’t affect performance too badly.

Finally, it’s worth noting that the \@empty is used in \@text@composite so that accents will work even when the argument is empty. If you say \'{} then this looks up \\T1\'-\@empty, which ought to be \relax, and so all is well. If we didn’t include the \@empty, then \'{} would expand to:

    \csname \string \T1\' - \string \endcsname

so the \endcsname would be \string’ed and the whole of the rest of the document would be put inside the \csname. This would not be good.

109 \def\@text@composite#1#2#3\@text@composite{%
110 \expandafter\@text@composite@x
111  \csname\string#1-\string#2\endcsname

112 }

113 \def\@text@composite@x#1#2{%
114 \ifx#1\relax
115  #2%
116 \else
117  #1%
118 \fi

119 }

The \@strip@args command just strips the arguments part out of the \meaning of a description macro:...->....

120 \def\@strip@args#1:#2-#3\@strip@args{#2}

The command \DeclareTextComposite uses these commands to declare a command which expands out to a letter.

121 \def\DeclareTextComposite#1#2#3#4{%
122 \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
123 \bgroup
124  \lccode`\@=#4%
125  \lowercase{%
126 \egroup
127  \reserved@a @%

128 }% 129 }

130 \@onlypreamble\DeclareTextComposite

\UseTextSymbol \UseTextAccent \@use@text@encoding These fragile commands access glyphs from different encodings. They use grotty low-level calls to the font selection scheme for speed, and in order to make sure that \UseTextSymbol doesn’t do anything which you’re not allowed to do between an \accent and its glyph.

131 \def\UseTextSymbol#1#2{%
132 \def\@wrong@font@char{\MessageBreak for \noexpand\symbol`\string#2'}%
133 \let\@curr@enc\cf@encoding

134 \@use@text@encoding{#1}%
135 #2%
136 \let\@wrong@font@char\@empty
137 \@use@text@encoding\@curr@enc

138 }

139 \def\UseTextAccent#1#2#3{%
140 \let\@curr@enc\cf@encoding
141 \@use@text@encoding{#1}%
142 #2{\@use@text@encoding\@curr@enc\selectfont#3}%
143 \@use@text@encoding\@curr@enc

144 }

145 \def\@use@text@encoding#1{%
146 \edef\f@encoding{#1}%
147 \xdef\font@name{%
148  \csname\curr@fontshape/\f@size\endcsname

149 }%

150 \pickup@font
151 \font@name
152 \@@enc@update

153 }

\DeclareTextSymbolDefault \DeclareTextAccentDefault Some syntactic sugar. Again, these should probably be optimized for speed.

154 \def\DeclareTextSymbolDefault#1#2{%
155 \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}%

156 }

157 \def\DeclareTextAccentDefault#1#2{%
158 \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}%

159 }

160 \@onlypreamble\DeclareTextSymbolDefault
161 \@onlypreamble\DeclareTextAccentDefault

1.2.2 Hyphenation

\patterns \@@patterns \hyphenation \@@hyphenation We redefine \patterns and \hyphenation to allow the use of commands declared

with \DeclareText* to be used inside them.

162 %\let\@@patterns\patterns
163 %\let\@@hyphenation\hyphenation
164 %\def\patterns{%
165 %   \bgroup
166 %      \let\protect\@empty
167 %      \let\@typeset@protect\@empty
168 %      \let\@changed@x\@changed@x@mouth
169 %   \afterassignment\egroup
170 %   \@@patterns

171 %}

172 %\def\hyphenation{%
173 %   \bgroup
174 %      \let\protect\@empty
175 %      \let\@typeset@protect\@empty

176 %      \let\@changed@x\@changed@x@mouth
177 %   \afterassignment\egroup
178 %   \@@hyphenation

179 %}

1.2.3 Miscellania

\a The \a command is used to access the accent commands even when they have been redefined (for example by the tabbing environment). Its internal name is

\@tabacckludge.
180 \def\@tabacckludge#1{\expandafter\@changed@cmd\csname#1\endcsname\relax}
181 \let\a=\@tabacckludge

1.2.4 Default encodings

We define the default encodings for most commands to be either OT1 or OMS.

The naming conventions in the kernel are not what we would use if we were starting from scratch… Those defined by DEK (like \ae and \ss) or by the TEX Users Group Technical Working Group on multi-lingual typesetting (like \th and \ng) have short names. Those which were added to the kernel in 1993 and early 1994 are named after their Adobe glyph names (like \guillemotleft and \quotedblbase). Unfortunately, this naming scheme won’t work for all glyphs, since some names (like \space) are already used, and some (like \endash) are very likely to be defined by users. So we’re now using the naming scheme of \text followed by the Adobe name, (like \textendash and \textsterling). Except that some glyphs don’t have Adobe names, so we’re using the names used by fontinst for those (like \textcompwordmark). Sigh.

Some accents from OT1:

182 \DeclareTextAccentDefault{\"}{OT1}
183 \DeclareTextAccentDefault{\'}{OT1}
184 \DeclareTextAccentDefault{\.}{OT1}
185 \DeclareTextAccentDefault{\=}{OT1}
186 \DeclareTextAccentDefault{\H}{OT1}
187 \DeclareTextAccentDefault{\^}{OT1}
188 \DeclareTextAccentDefault{\`}{OT1}
189 \DeclareTextAccentDefault{\b}{OT1}
190 \DeclareTextAccentDefault{\c}{OT1}
191 \DeclareTextAccentDefault{\d}{OT1}
192 \DeclareTextAccentDefault{\r}{OT1}
193 \DeclareTextAccentDefault{\u}{OT1}
194 \DeclareTextAccentDefault{\v}{OT1}
195 \DeclareTextAccentDefault{\~}{OT1}

Some symbols from OT1:

196 \DeclareTextSymbolDefault{\AA}{OT1}
197 \DeclareTextSymbolDefault{\AE}{OT1}
198 \DeclareTextSymbolDefault{\L}{OT1}
199 \DeclareTextSymbolDefault{\OE}{OT1}

200 \DeclareTextSymbolDefault{\O}{OT1}
201 \DeclareTextSymbolDefault{\aa}{OT1}
202 \DeclareTextSymbolDefault{\ae}{OT1}
203 \DeclareTextSymbolDefault{\i}{OT1}
204 \DeclareTextSymbolDefault{\j}{OT1}
205 \DeclareTextSymbolDefault{\l}{OT1}
206 \DeclareTextSymbolDefault{\oe}{OT1}
207 \DeclareTextSymbolDefault{\o}{OT1}
208 \DeclareTextSymbolDefault{\ss}{OT1}
209 \DeclareTextSymbolDefault{\textdollar}{OT1}
210 \DeclareTextSymbolDefault{\textemdash}{OT1}
211 \DeclareTextSymbolDefault{\textendash}{OT1}
212 \DeclareTextSymbolDefault{\textexclamdown}{OT1}
213 %\DeclareTextSymbolDefault{\texthyphenchar}{OT1}
214 %\DeclareTextSymbolDefault{\texthyphen}{OT1}
215 \DeclareTextSymbolDefault{\textquestiondown}{OT1}
216 \DeclareTextSymbolDefault{\textquotedblleft}{OT1}
217 \DeclareTextSymbolDefault{\textquotedblright}{OT1}
218 \DeclareTextSymbolDefault{\textquoteleft}{OT1}
219 \DeclareTextSymbolDefault{\textquoteright}{OT1}
220 \DeclareTextSymbolDefault{\textsterling}{OT1}

Some symbols from OMS:

221 \DeclareTextSymbolDefault{\textbackslash}{OMS}
222 \DeclareTextSymbolDefault{\textbar}{OMS}
223 \DeclareTextSymbolDefault{\textbraceleft}{OMS}
224 \DeclareTextSymbolDefault{\textbraceright}{OMS}
225 \DeclareTextSymbolDefault{\textbullet}{OMS}
226 \DeclareTextSymbolDefault{\textdaggerdbl}{OMS}
227 \DeclareTextSymbolDefault{\textdagger}{OMS}
228 \DeclareTextSymbolDefault{\textparagraph}{OMS}
229 \DeclareTextSymbolDefault{\textperiodcentered}{OMS}
230 \DeclareTextSymbolDefault{\textsection}{OMS}
231 \DeclareTextAccentDefault{\textcircled}{OMS}

Some symbols from OML:

232 \DeclareTextSymbolDefault{\textless}{OML}
233 \DeclareTextSymbolDefault{\textgreater}{OML}
234 \DeclareTextAccentDefault{\t}{OML}

Some defaults we can fake: For historical reasons \copyright needs {} around the definition. The interface for defining this will CHANGE, but currently use \expandafter to add braces at the appropriate points.

235 \DeclareTextCommandDefault{\copyright}{\textcircled{c}}
236 \expandafter\def\expandafter
237  \copyright\expandafter{\expandafter{\copyright}}
238 \DeclareTextCommandDefault{\textasciicircum}{\^{}}
239 \DeclareTextCommandDefault{\textasciitilde}{\~{}}
240 \DeclareTextCommandDefault{\textcompwordmark}{\kern\z@}
241 \DeclareTextCommandDefault{\textunderscore}{%

242 \leavevmode\mathunderscore

243 }

244 \DeclareTextCommandDefault{\textvisiblespace}{%
245 \mbox{\kern.06em\vrule \@height.3ex}%
246 \vbox{\hrule \@width.3em}%
247 \hbox{\vrule \@height.3ex}%

248 }

249 \DeclareTextCommandDefault{\textellipsis}{%
250 .\kern\fontdimen3\font
251 .\kern\fontdimen3\font
252 .\kern\fontdimen3\font

253 }

254 \DeclareTextCommandDefault{\textregistered}{\textcircled{\textsc r}}
255 \DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}}
256 \DeclareTextCommandDefault{\SS}{SS}

1.2.5 Math material

Some commands can be used in both text and math mode:

257 \DeclareRobustCommand{\$}{\ifmmode\mathdollar\else\textdollar\fi}
258 \DeclareRobustCommand{\{}{\ifmmode\lbrace\else\textbraceleft\fi}
259 \DeclareRobustCommand{\}}{\ifmmode\rbrace\else\textbraceright\fi}
260 \DeclareRobustCommand{\P}{\ifmmode\mathparagraph\else\textparagraph\fi}
261 \DeclareRobustCommand{\S}{\ifmmode\mathsection\else\textsection\fi}
262 \DeclareRobustCommand{\dag}{\ifmmode{\dagger}\else\textdagger\fi}
263 \DeclareRobustCommand{\ddag}{\ifmmode{\ddagger}\else\textdaggerdbl\fi}
264 \DeclareRobustCommand{\_}{%
265 \ifmmode\mathunderscore\else\textunderscore\fi

266 }

267 \DeclareRobustCommand{\pounds}{%
268 \ifmmode\mathsterling\else\textsterling\fi

269 }

270 \DeclareRobustCommand{\dots}{%
271 \ifmmode\mathellipsis\else\textellipsis\fi

272 }

273 \let\ldots\dots

274 ⟨/2ekernel | autoload⟩

1.3 The fontenc package

This package allows authors to specify which encodings they will use. For each encoding FOO, the package looks to see if the encoding FOO has already been declared. If it hasn’t, the file FOOenc.def is loaded. The default encoding is set to

 be FOO.

275 ⟨∗package⟩

276 \NeedsTeXFormat{LaTeX2e}
277 \ProvidesPackage{fontenc}[1994/12/14 v1.7f Standard LaTeX package]
278 \DeclareOption*{%
279 \let\encodingdefault\CurrentOption

280 \InputIfFileExists{\CurrentOption enc.def}{}{%
281  \@warning{Encoding file `\CurrentOption enc.def' not found}%

282 }% 283 }

284 \ProcessOptions*
285 \fontencoding\encodingdefault\selectfont

286 ⟨/package⟩

1.4 Definitions for the OT1 encoding

The definitions for the ‘TEX text’ (OT1) encoding.

287 ⟨∗OT1⟩

288 \ProvidesFile{OT1enc.def}[1994/12/14 Standard LaTeX file]

Declare the encoding.

289 \DeclareFontEncoding{OT1}{}{}

Declare the accents.

290 \DeclareTextAccent{\"}{OT1}{127}
291 \DeclareTextAccent{\'}{OT1}{19}
292 \DeclareTextAccent{\.}{OT1}{95}
293 \DeclareTextAccent{\=}{OT1}{22}
294 \DeclareTextAccent{\^}{OT1}{94}
295 \DeclareTextAccent{\`}{OT1}{18}
296 \DeclareTextAccent{\~}{OT1}{126}
297 \DeclareTextAccent{\H}{OT1}{125}
298 \DeclareTextAccent{\u}{OT1}{21}
299 \DeclareTextAccent{\v}{OT1}{20}
300 \DeclareTextAccent{\r}{OT1}{23}

Some accents have to be built by hand:

301 \DeclareTextCommand{\b}{OT1}[1]
302 {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
303  \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}}
304 \DeclareTextCommand{\c}{OT1}[1]
305 {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
306  \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
307 \DeclareTextCommand{\d}{OT1}[1]
308 {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}.\hidewidth}}}

Declare the text symbols.

309 \DeclareTextSymbol{\AE}{OT1}{29}
310 \DeclareTextSymbol{\OE}{OT1}{30}
311 \DeclareTextSymbol{\O}{OT1}{31}
312 \DeclareTextSymbol{\ae}{OT1}{26}
313 \DeclareTextSymbol{\i}{OT1}{16}
314 \DeclareTextSymbol{\j}{OT1}{17}
315 \DeclareTextSymbol{\oe}{OT1}{27}
316 \DeclareTextSymbol{\o}{OT1}{28}
317 \DeclareTextSymbol{\ss}{OT1}{25}
318 \DeclareTextSymbol{\textemdash}{OT1}{124}

319 \DeclareTextSymbol{\textendash}{OT1}{123}
320 \DeclareTextSymbol{\textexclamdown}{OT1}{60}
321 %\DeclareTextSymbol{\texthyphenchar}{OT1}{`\-}
322 %\DeclareTextSymbol{\texthyphen}{OT1}{`\-}
323 \DeclareTextSymbol{\textquestiondown}{OT1}{62}
324 \DeclareTextSymbol{\textquotedblleft}{OT1}{92}
325 \DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
326 \DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
327 \DeclareTextSymbol{\textquoteright}{OT1}{`\'}

Some symbols which are faked from others:

328 \DeclareTextCommand{\aa}{OT1}
329 {{\accent23a}}
330 \DeclareTextCommand{\L}{OT1}
331 {\leavevmode\setbox\z@\hbox{L}\hb@xt@\wd\z@{\hss\@xxxii L}}
332 \DeclareTextCommand{\l}{OT1}
333 {{\@xxxii l}}
334 \DeclareTextCommand{\AA}{OT1}
335 {\leavevmode\setbox\z@\hbox{h}\dimen@\ht\z@\advance\dimen@-1ex%
336  \rlap{\raise.67\dimen@\hbox{\char23}}A}

In the OT1 encoding, £ and $ share a slot.

337 \DeclareTextCommand{\textdollar}{OT1}{{%
338 \ifdim \fontdimen\@ne\font >\z@
339  \slshape
340 \else
341  \upshape
342 \fi
343 \char`\$}}
344 \DeclareTextCommand{\textsterling}{OT1}{{%
345 \ifdim \fontdimen\@ne\font >\z@
346  \itshape
347 \else
348  \fontshape{ui}\selectfont
349 \fi
350 \char`\$}}

351 ⟨/OT1⟩

1.5 Definitions for the T1 encoding

The definitions for the ‘Extended TEX text’ (T1) encoding.

352 ⟨∗T1⟩

353 \ProvidesFile{T1enc.def}[1994/12/14 Standard LaTeX file]

Declare the encoding.

354 \DeclareFontEncoding{T1}{}{}

Declare the accents.

355 \DeclareTextAccent{\`}{T1}{0}
356 \DeclareTextAccent{\'}{T1}{1}
357 \DeclareTextAccent{\^}{T1}{2}

358 \DeclareTextAccent{\~}{T1}{3}
359 \DeclareTextAccent{\"}{T1}{4}
360 \DeclareTextAccent{\H}{T1}{5}
361 \DeclareTextAccent{\r}{T1}{6}
362 \DeclareTextAccent{\v}{T1}{7}
363 \DeclareTextAccent{\u}{T1}{8}
364 \DeclareTextAccent{\=}{T1}{9}
365 \DeclareTextAccent{\.}{T1}{10}

Some accents have to be built by hand:

366 \DeclareTextCommand{\b}{T1}[1]
367 {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
368  \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}}}
369 \DeclareTextCommand{\c}{T1}[1]
370 {\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent11 #1%
371  \else{\ooalign{\hidewidth\char11\hidewidth
372  \crcr\unhbox\z@}}\fi}
373 \DeclareTextCommand{\d}{T1}[1]
374 {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}.\hidewidth}}}
375 \DeclareTextCommand{\k}{T1}[1]
376 {\oalign{\null#1\crcr\hidewidth\char12}}

Declare the text symbols.

377 \DeclareTextSymbol{\AA}{T1}{197}
378 \DeclareTextSymbol{\AE}{T1}{198}
379 \DeclareTextSymbol{\DH}{T1}{208}
380 \DeclareTextSymbol{\DJ}{T1}{208}
381 \DeclareTextSymbol{\L}{T1}{138}
382 \DeclareTextSymbol{\NG}{T1}{141}
383 \DeclareTextSymbol{\OE}{T1}{215}
384 \DeclareTextSymbol{\O}{T1}{216}
385 \DeclareTextSymbol{\SS}{T1}{223}
386 \DeclareTextSymbol{\TH}{T1}{222}
387 \DeclareTextSymbol{\aa}{T1}{229}
388 \DeclareTextSymbol{\ae}{T1}{230}
389 \DeclareTextSymbol{\dh}{T1}{240}
390 \DeclareTextSymbol{\dj}{T1}{158}
391 \DeclareTextSymbol{\guillemotleft}{T1}{19}
392 \DeclareTextSymbol{\guillemotright}{T1}{20}
393 \DeclareTextSymbol{\guilsinglleft}{T1}{14}
394 \DeclareTextSymbol{\guilsinglright}{T1}{15}
395 \DeclareTextSymbol{\i}{T1}{25}
396 \DeclareTextSymbol{\j}{T1}{26}
397 \DeclareTextSymbol{\l}{T1}{170}
398 \DeclareTextSymbol{\ng}{T1}{173}
399 \DeclareTextSymbol{\oe}{T1}{247}
400 \DeclareTextSymbol{\o}{T1}{248}
401 \DeclareTextSymbol{\quotedblbase}{T1}{18}
402 \DeclareTextSymbol{\quotesinglbase}{T1}{13}
403 \DeclareTextSymbol{\ss}{T1}{255}
404 \DeclareTextSymbol{\textasciicircum}{T1}{`\^}

405 \DeclareTextSymbol{\textasciitilde}{T1}{`\~}
406 \DeclareTextSymbol{\textbackslash}{T1}{`\\}
407 \DeclareTextSymbol{\textbar}{T1}{`\|}
408 \DeclareTextSymbol{\textbraceleft}{T1}{`\{}
409 \DeclareTextSymbol{\textbraceright}{T1}{`\}}
410 \DeclareTextSymbol{\textcompwordmark}{T1}{23}
411 \DeclareTextSymbol{\textdollar}{T1}{`\$}
412 \DeclareTextSymbol{\textemdash}{T1}{22}
413 \DeclareTextSymbol{\textendash}{T1}{21}
414 \DeclareTextSymbol{\textexclamdown}{T1}{189}
415 \DeclareTextSymbol{\textgreater}{T1}{`\>}
416 %\DeclareTextSymbol{\texthyphenchar}{T1}{127}
417 %\DeclareTextSymbol{\texthyphen}{T1}{`\-}
418 \DeclareTextSymbol{\textless}{T1}{`\<}
419 \DeclareTextSymbol{\textquestiondown}{T1}{190}
420 \DeclareTextSymbol{\textquotedblleft}{T1}{16}
421 \DeclareTextSymbol{\textquotedblright}{T1}{17}
422 \DeclareTextSymbol{\textquotedbl}{T1}{`\"}
423 \DeclareTextSymbol{\textquoteleft}{T1}{`\`}
424 \DeclareTextSymbol{\textquoteright}{T1}{`\'}
425 \DeclareTextSymbol{\textsection}{T1}{159}
426 \DeclareTextSymbol{\textsterling}{T1}{191}
427 \DeclareTextSymbol{\textunderscore}{T1}{95}
428 \DeclareTextSymbol{\textvisiblespace}{T1}{32}
429 \DeclareTextSymbol{\th}{T1}{254}

Declare the composites.

430 \DeclareTextComposite{\.}{T1}{i}{`\i}
431 \DeclareTextComposite{\u}{T1}{A}{128}
432 \DeclareTextComposite{\k}{T1}{A}{129}
433 \DeclareTextComposite{\'}{T1}{C}{130}
434 \DeclareTextComposite{\v}{T1}{C}{131}
435 \DeclareTextComposite{\v}{T1}{D}{132}
436 \DeclareTextComposite{\v}{T1}{E}{133}
437 \DeclareTextComposite{\k}{T1}{E}{134}
438 \DeclareTextComposite{\u}{T1}{G}{135}
439 \DeclareTextComposite{\'}{T1}{L}{136}
440 \DeclareTextComposite{\v}{T1}{L}{137}
441 \DeclareTextComposite{\'}{T1}{N}{139}
442 \DeclareTextComposite{\v}{T1}{N}{140}
443 \DeclareTextComposite{\H}{T1}{O}{142}
444 \DeclareTextComposite{\'}{T1}{R}{143}
445 \DeclareTextComposite{\v}{T1}{R}{144}
446 \DeclareTextComposite{\'}{T1}{S}{145}
447 \DeclareTextComposite{\v}{T1}{S}{146}
448 \DeclareTextComposite{\c}{T1}{S}{147}
449 \DeclareTextComposite{\v}{T1}{T}{148}
450 \DeclareTextComposite{\c}{T1}{T}{149}
451 \DeclareTextComposite{\H}{T1}{U}{150}
452 \DeclareTextComposite{\r}{T1}{U}{151}

453 \DeclareTextComposite{\"}{T1}{Y}{152}
454 \DeclareTextComposite{\'}{T1}{Z}{153}
455 \DeclareTextComposite{\v}{T1}{Z}{154}
456 \DeclareTextComposite{\.}{T1}{Z}{155}
457 \DeclareTextComposite{\.}{T1}{I}{157}
458 \DeclareTextComposite{\u}{T1}{a}{160}
459 \DeclareTextComposite{\k}{T1}{a}{161}
460 \DeclareTextComposite{\'}{T1}{c}{162}
461 \DeclareTextComposite{\v}{T1}{c}{163}
462 \DeclareTextComposite{\v}{T1}{d}{164}
463 \DeclareTextComposite{\v}{T1}{e}{165}
464 \DeclareTextComposite{\k}{T1}{e}{166}
465 \DeclareTextComposite{\u}{T1}{g}{167}
466 \DeclareTextComposite{\'}{T1}{l}{168}
467 \DeclareTextComposite{\v}{T1}{l}{169}
468 \DeclareTextComposite{\'}{T1}{n}{171}
469 \DeclareTextComposite{\v}{T1}{n}{172}
470 \DeclareTextComposite{\H}{T1}{o}{174}
471 \DeclareTextComposite{\'}{T1}{r}{175}
472 \DeclareTextComposite{\v}{T1}{r}{176}
473 \DeclareTextComposite{\'}{T1}{s}{177}
474 \DeclareTextComposite{\v}{T1}{s}{178}
475 \DeclareTextComposite{\c}{T1}{s}{179}
476 \DeclareTextComposite{\v}{T1}{t}{180}
477 \DeclareTextComposite{\c}{T1}{t}{181}
478 \DeclareTextComposite{\H}{T1}{u}{182}
479 \DeclareTextComposite{\r}{T1}{u}{183}
480 \DeclareTextComposite{\"}{T1}{y}{184}
481 \DeclareTextComposite{\'}{T1}{z}{185}
482 \DeclareTextComposite{\v}{T1}{z}{186}
483 \DeclareTextComposite{\.}{T1}{z}{187}
484 \DeclareTextComposite{\`}{T1}{A}{192}
485 \DeclareTextComposite{\'}{T1}{A}{193}
486 \DeclareTextComposite{\^}{T1}{A}{194}
487 \DeclareTextComposite{\~}{T1}{A}{195}
488 \DeclareTextComposite{\"}{T1}{A}{196}
489 \DeclareTextComposite{\r}{T1}{A}{197}
490 \DeclareTextComposite{\c}{T1}{C}{199}
491 \DeclareTextComposite{\`}{T1}{E}{200}
492 \DeclareTextComposite{\'}{T1}{E}{201}
493 \DeclareTextComposite{\^}{T1}{E}{202}
494 \DeclareTextComposite{\"}{T1}{E}{203}
495 \DeclareTextComposite{\`}{T1}{I}{204}
496 \DeclareTextComposite{\'}{T1}{I}{205}
497 \DeclareTextComposite{\^}{T1}{I}{206}
498 \DeclareTextComposite{\"}{T1}{I}{207}
499 \DeclareTextComposite{\~}{T1}{N}{209}
500 \DeclareTextComposite{\`}{T1}{O}{210}
501 \DeclareTextComposite{\'}{T1}{O}{211}
502 \DeclareTextComposite{\^}{T1}{O}{212}

503 \DeclareTextComposite{\~}{T1}{O}{213}
504 \DeclareTextComposite{\"}{T1}{O}{214}
505 \DeclareTextComposite{\`}{T1}{U}{217}
506 \DeclareTextComposite{\'}{T1}{U}{218}
507 \DeclareTextComposite{\^}{T1}{U}{219}
508 \DeclareTextComposite{\"}{T1}{U}{220}
509 \DeclareTextComposite{\'}{T1}{Y}{221}
510 \DeclareTextComposite{\`}{T1}{a}{224}
511 \DeclareTextComposite{\'}{T1}{a}{225}
512 \DeclareTextComposite{\^}{T1}{a}{226}
513 \DeclareTextComposite{\~}{T1}{a}{227}
514 \DeclareTextComposite{\"}{T1}{a}{228}
515 \DeclareTextComposite{\r}{T1}{a}{229}
516 \DeclareTextComposite{\c}{T1}{c}{231}
517 \DeclareTextComposite{\`}{T1}{e}{232}
518 \DeclareTextComposite{\'}{T1}{e}{233}
519 \DeclareTextComposite{\^}{T1}{e}{234}
520 \DeclareTextComposite{\"}{T1}{e}{235}
521 \DeclareTextComposite{\`}{T1}{i}{236}
522 \DeclareTextComposite{\`}{T1}{\i}{236}
523 \DeclareTextComposite{\'}{T1}{i}{237}
524 \DeclareTextComposite{\'}{T1}{\i}{237}
525 \DeclareTextComposite{\^}{T1}{i}{238}
526 \DeclareTextComposite{\^}{T1}{\i}{238}
527 \DeclareTextComposite{\"}{T1}{i}{239}
528 \DeclareTextComposite{\"}{T1}{\i}{239}
529 \DeclareTextComposite{\~}{T1}{n}{241}
530 \DeclareTextComposite{\`}{T1}{o}{242}
531 \DeclareTextComposite{\'}{T1}{o}{243}
532 \DeclareTextComposite{\^}{T1}{o}{244}
533 \DeclareTextComposite{\~}{T1}{o}{245}
534 \DeclareTextComposite{\"}{T1}{o}{246}
535 \DeclareTextComposite{\`}{T1}{u}{249}
536 \DeclareTextComposite{\'}{T1}{u}{250}
537 \DeclareTextComposite{\^}{T1}{u}{251}
538 \DeclareTextComposite{\"}{T1}{u}{252}
539 \DeclareTextComposite{\'}{T1}{y}{253}

540 ⟨/T1⟩

1.6 Definitions for the OMS encoding

The definitions for the ‘TEX math symbol’ (OMS) encoding. Even though this is meant to be a math font, it includes some of the standard L^{A}TEX text symbols.

541 ⟨∗OMS⟩

542 \ProvidesFile{OMSenc.def}[1994/12/14 Standard LaTeX file]

Declare the encoding.

543 \DeclareFontEncoding{OMS}{}{}

Declare the symbols.

544 \DeclareTextSymbol{\textbackslash}{OMS}{"6E}
545 \DeclareTextSymbol{\textbar}{OMS}{"6A}
546 \DeclareTextSymbol{\textbraceleft}{OMS}{"66}
547 \DeclareTextSymbol{\textbraceright}{OMS}{"67}
548 \DeclareTextSymbol{\textbullet}{OMS}{"0F}
549 \DeclareTextSymbol{\textdaggerdbl}{OMS}{"7A}
550 \DeclareTextSymbol{\textdagger}{OMS}{"79}
551 \DeclareTextSymbol{\textparagraph}{OMS}{"7B}
552 \DeclareTextSymbol{\textperiodcentered}{OMS}{"01}
553 \DeclareTextSymbol{\textsection}{OMS}{"78}
554 \DeclareTextCommand{\textcircled}{OMS}[1]{{%
555 \ooalign{%
556  \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
557  \char"0D

558 }% 559 }} 560 ⟨/OMS⟩

1.7 Definitions for the OML encoding

The definitions for the ‘TEX math italic’ (OML) encoding. Even though this is meant to be a math font, it includes some of the standard L^{A}TEX text symbols.

561 ⟨∗OML⟩

562 \ProvidesFile{OMLenc.def}[1994/12/14 Standard LaTeX file]

Declare the encoding.

563 \DeclareFontEncoding{OML}{}{}

Declare the symbols.

564 \DeclareTextSymbol{\textless}{OML}{`\<}
565 \DeclareTextSymbol{\textgreater}{OML}{`\>}
566 \DeclareTextAccent{\t}{OML}{"7F}

567 ⟨/OML⟩