Debian Codegraph @

texmf-dist/source/latex/base/utf8ienc.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 %
30 % \iffalse
31 %<*driver>
32 \documentclass{ltxdoc}
33 \usepackage[latin1,utf8]{inputenc}% force utf8 to be re-loaded, to get version info
34 \GetFileInfo{utf8.def}
35 \title{Providing some UTF-8 support via \texttt{inputenc}}
36 \date{\fileversion\space\filedate{} printed \today}
37 \author{%
38 David Carlisle \and Frank Mittelbach \and
39 Chris Rowley\thanks{Borrowing heavily from tables by Sebastian Rahtz; some table
40 and code cleanup by Javier Bezos}}
41 \begin{document}
42 \MaintainedByLaTeXTeam{latex}
43 \maketitle
44 \tableofcontents
45 \DocInput{utf8ienc.dtx}
46 \end{document}
47 %</driver>
48 % \fi
49 %
50 % \newpage
51 %
52 % \section{Introduction}
53 %
54 %
55 % \subsection{Background and general stuff}
56 %
57 % For many reasons what this package provides is a long way from any
58 % type of `Unicode compliance'.
59 %
60 % In stark contrast to 8-bit character sets, with 16 or more bits it can
61 % easily be very inefficient to support the full range.\footnote{In
62 % fact, \LaTeX's current 8-bit support does not go so far as to make
63 % all 8-bit characters into valid input.} Moreover, useful support of
64 % character input by a typesetting system overwhelmingly means finding
65 % an acceptable visual representation of a sequence of characters and
66 % this, for \LaTeX{}, means having available a suitably encoded 8-bit
67 % font.
68 %
69 % Unfortunately it is not possible to predict exactly what valid UTF-8
70 % octet sequences will appear in a particular file so it is best to
71 % make all the unsupported but valid sequences produce a reasonably
72 % clear and noticeable error message.
73 %
74 % There are two directions from which to approach the question of what
75 % to load. One is to specify the ranges of Unicode characters that will
76 % result in some sensible typesetting; this requires the provider to
77 % ensure that suitable fonts are loaded and that these input characters
78 % generate the correct typesetting via the encodings of those fonts. The
79 % other is to inspect the font encodings to be used and use these to
80 % define which input Unicode characters should be supported.
81 %
82 % For Western European languages, at least, going in either direction
83 % leads to many straightforward decisions and a few that are more
84 % subjective. In both cases some of the specifications are \TeX{}
85 % specific whilst most are independent of the particular typesetting
86 % software in use.
87 %
88 % As we have argued elsewhere, \LaTeX{} needs to refer to characters via
89 % `seven-bit-text' names and, so far, these have been chosen by
90 % reference to historical sources such as Plain \TeX{} or Adobe encoding
91 % descriptions. It is unclear whether this ad hoc naming structure should
92 % simply be extended or whether it would be useful to
93 % supplement it with standardised internal Unicode character names such as
94 % one or more of the following:\footnote{Burkhard und Holger Mittelbach
95 % spielen mit mir! Sie haben etwas hier geschrieben.}
96 %
97 % \begin{verbatim}
98 % \ltxutwochar <4 hex digits>
99 %
100 % \ltxuchar {<hex digits>}
101 % B H U R R R
102 %
103 % \ltxueightchartwo <2 utf8 octets as 8-bit char tokens>
104 % \ltxueightcharthree <3 utf8 octets ...>
105 % \ltxueightcharfour <4 utf8 octets ...>
106 % \end{verbatim}
107 %
108 %
109 % \subsection{More specific stuff}
110 %
111 % In addition to setting up the mechanism for reading UTF-8 characters
112 % and specifying the \LaTeX-level support available, this package
113 % contains support for some default historically expected \TeX-related
114 % characters and some example `Unicode definition files' for standard
115 % font encodings.
116 %
117 %
118 % \subsection{Notes}
119 %
120 % This package does not support Unicode combining characters as \TeX{}
121 % is not really equipped to make this possible.
122 %
123 % No attempt is made to be useful beyond Latin, and maybe Cyrillic,
124 % for European languages (as of now).
125 %
126 %
127 % \subsection{Basic operation of the code}
128 %
129 % The \texttt{inputenc} package makes the upper 8-bit characters active and
130 % assigns to all of them an error message. It then waits for the
131 % input encoding files to change this set-up. Similarly, whenever
132 % |\inputencoding| is encountered in a document, first the upper
133 % 8-bit characters are set back to produce an error and then the
134 % definitions for the new input encoding are loaded, changing some of the
135 % previous settings.
136 %
137 % The 8-bit input encodings currently supported by \texttt{inputenc}
138 % all use declarations such as |\DeclareInputText| and the like to map an
139 % 8-bit number to some \LaTeX{} internal form, e.g.~to |\"a|.
140 %
141 % The situation when supporting UTF-8 as the input encoding is
142 % different, however. Here we only have to set up the actions of
143 % those 8-bit numbers that can be the first octet in a UTF-8
144 % representation of a Unicode character. But we cannot simply set
145 % this to some internal \LaTeX{} form since the Unicode character
146 % consists of more than one octet; instead we have to define this
147 % starting octet to parse the right number of further octets that
148 % together form the UTF-8 representation of some Unicode character.
149 %
150 % Therefore when switching to \texttt{utf8} within the
151 % \texttt{inputenc} framework the characters with numbers (hex)
152 % from \texttt{"C2} to \texttt{"DF} are defined to parse for a
153 % second octet following, the characters from \texttt{"E0} to
154 % \texttt{"EF} are defined to parse for two more octets and finally
155 % the characters from \texttt{"F0} to \texttt{"F4} are defined to
156 % parse for three additional octets. These additional octets are
157 % always in the range \texttt{"80} to \texttt{"BF}.
158 %
159 % Thus, when such a character is encountered in the document (so
160 % long as expansion is not prohibited) a defined number of
161 % additional octets (8-bit characters) are read and from them a
162 % unique control sequence name is immediately constructed.
163 %
164 % This control sequence is either defined (good) or undefined
165 % (likely); in the latter case the user gets an error message
166 % saying that this UTF-8 sequence (or, better, Unicode character)
167 % is not supported.
168 %
169 % If the control sequence is set up to do something useful then it will
170 % expand to a \LaTeX{} internal form: e.g.~for the utf8 sequence of
171 % two octets \texttt{"C3 "A4} we get |\"a| as the
172 % internal form which then, depending on the font encoding,
173 % eventually resolves to the single glyph `latin-a-umlaut' or to
174 % the composite glyph `latin-a with an umlaut accent'.
175 %
176 % These mappings from (UTF-8 encoded) Unicode characters to \LaTeX{}
177 % internal forms are made indirectly. The code below provides a
178 % declaration |\DeclareUnicodeCharacter| which maps Unicode numbers
179 % (as hexadecimal) to \LaTeX{} internal forms.
180 %
181 % This mapping needs to be set up only once so it is done at
182 % |\begin{document}| by looking at the list of font encodings that
183 % are loaded by the document and providing mappings related to
184 % those font encodings whenever these are available. Thus at most
185 % only those Unicode characters that can be represented by the glyphs
186 % available in these encodings will be defined.
187 %
188 % Technically this is done by loading one file per encoding,
189 % if available, that is supposed to provide the necessary mapping
190 % information.
191 %
192 %
193 % \MaybeStop{}
194 %
195 %
196 %
197 %
198 % \section{Coding}
199 %
200 % \subsection{Housekeeping}
201 %
202 % The usual introductory bits and pieces:
203 %
204 % \begin{macrocode}
205 %<utf8>\ProvidesFile{utf8.def}
206 %<test>\ProvidesFile{utf8-test.tex}
207 %<+lcy> \ProvidesFile{lcyenc.dfu}
208 %<+ly1> \ProvidesFile{ly1enc.dfu}
209 %<+oms> \ProvidesFile{omsenc.dfu}
210 %<+ot1> \ProvidesFile{ot1enc.dfu}
211 %<+ot2> \ProvidesFile{ot2enc.dfu}
212 %<+t1> \ProvidesFile{t1enc.dfu}
213 %<+t2a> \ProvidesFile{t2aenc.dfu}
214 %<+t2b> \ProvidesFile{t2benc.dfu}
215 %<+t2c> \ProvidesFile{t2cenc.dfu}
216 %<+ts1> \ProvidesFile{ts1enc.dfu}
217 %<+x2> \ProvidesFile{x2enc.dfu}
218 %<+all> \ProvidesFile{utf8enc.dfu}
219 %<-utf8-2018> [2022/06/07 v1.3c UTF-8 support]
220 % \end{macrocode}
221 %
222 % \begin{macrocode}
223 %<*utf8>
224 % \end{macrocode}
225 % This is a temporary fix for the e-p\TeX{} / e-up\TeX{} engines that do not yet
226 % have a |\ifincsname| primitive. Once this is available the extra file will
227 % be dropped.
228 % \changes{v1.2h}{2019/07/09}{Temp rollback fix for e-pTeX}
229 % \begin{macrocode}
230 \ifx\ifincsname\@undefined % old e-pTeX or e-upTeX engines
231 \input utf8-2018.def
232 \expandafter\@firstofone
233 \else
234 \expandafter\@gobble
235 \fi
236 \endinput
237 % \end{macrocode}
238 %
239 % \begin{macrocode}
240 \makeatletter
241 % \end{macrocode}
242 % We restore the |\catcode| of space (which is set to ignore in
243 % \texttt{inputenc}) while reading \texttt{.def} files. Otherwise
244 % we would need to explicitly use |\space| all over the place in
245 % error and log messages.
246 % \changes{v1.1d}{2004/05/08}{Explicitly set catcode of space}
247 % \begin{macrocode}
248 \catcode`\ \saved@space@catcode
249 % \end{macrocode}
250 %
251 %
252 %
253 % \subsection{Parsing UTF-8 input}
254 %
255 % A UTF-8 char (that is not actually a 7-bit char, i.e.~a single
256 % octet) is parsed as follows: each starting octet is an active
257 % \TeX{} character token; each of these is defined below to be a
258 % macro with one to three arguments nominally (depending on the
259 % starting octet). It calls one of |\UTFviii@two@octets|,
260 % |\UTFviii@three@octets|, or |\UTFviii@four@octets| which then
261 % actually picks up the remaining octets as the argument(s).
262 %
263 % \begin{itemize}
264 % \item When typesetting we pick up the necessary number of additional
265 % octets, check if they form a command that \LaTeX{} knows about
266 % (via \cs{csname} \texttt{u8:}\cs{string}
267 % \verb=#1=\cs{string} \verb=#2...=\cs{endcsname}) and if so use that
268 % for typesetting. \cs{string} is needed as the octets may (all?) be
269 % active and we want the literal values in the name.
270 %
271 % \item If the UTF-8 character is going to be part of a label, then it is
272 % essentially becoming part of some csname and with the
273 % test \cs{ifincsname} we can find this out. If so, we render the whole
274 % sequence off octets harmless by using \cs{string} too when the
275 % starting octet executes (\cs{UTF@...@octets@string}).
276 %
277 % \item Another possible case is that \cs{protect} has \emph{not} the meaning
278 % of \cs{typeset@protect}. In that case we may do a \cs{write} or we may do
279 % a \cs{protected@edef} or \ldots{} In all such cases we want to keep the
280 % sequence of octets unchanged, but we can't use \cs{string} this time, since at
281 % least in the case of \cs{protect@edef} the result may later be
282 % typeset after all (in fact that is quite likely) and so at that
283 % point the starting octet needs to be an active character again
284 % (the others could be stringified). So for this case we use \cs{noexpand}
285 % ((\cs{[email protected]@octets@noexpand}).
286 % \end{itemize}
287 %
288 % \begin{macro}{\UTFviii@two@octets}
289 % \changes{v1.2a}{2018/03/24}{Macros made `\cs{long} for improved error messages}%
290 % Putting that all together the code for a start octet of a two
291 % byte sequence would then look like this:
292 % \begin{macrocode}
293 \long\def\UTFviii@two@octets{%
294 \ifincsname
295 \expandafter \UTF@two@octets@string
296 \else
297 \ifx \protect\@typeset@protect \else
298 \expandafter\expandafter\expandafter \UTF@two@octets@noexpand
299 \fi
300 \fi
301 \UTFviii@two@octets@combine
302 }
303 % \end{macrocode}
304
305 % \cs{ifcsname} is tested first because that can be true even if we
306 % are otherwise doing typesetting. If this is the case we use
307 % \cs{string} on the whole octet
308 % sequence. \cs{UTF@two@octets@string} not only does this but also
309 % gets rid of the command \cs{UTFviii@two@octets@combine} in the input
310 % stream by picking it up as a first argument and dropping it.
311 %
312 % If this is not the case and we are doing typesetting (i.e.,
313 % \cs{protect} is \cs{typeset@protect}), then we execute
314 % \cs{UTFviii@two@octets@combine} which picks up all octets and typesets
315 % the character (or generates an error if it doesn't know how to
316 % typeset it).
317 %
318 % However, if we are not doing typesetting, then we execute the
319 % command \cs{UTFviii@two@octets@noexpand} which works like
320 % \cs{UTF@two@octets@string} but uses \cs{noexpand} instead of
321 % \cs{string}. This way the sequence is temporary rendered harmless,
322 % e.g., would display as is or stays put inside a
323 % \cs{protected@edef}. But if the result is later reused the
324 % starting octet is still active and so will be able to construct
325 % the UTF-8 character again.
326 % \end{macro}
327 %
328 %
329 % \begin{macro}{\UTFviii@three@octets}
330 % \changes{v1.2a}{2018/03/24}{Macros made `\cs{long} for improved error messages}%
331 % \begin{macro}{\UTFviii@four@octets}
332 % \changes{v1.2a}{2018/03/24}{Macros made `\cs{long} for improved
333 % error messages}
334 % The definitions for the other starting octets
335 % are the same except that they pick up more octets after them.
336 % \begin{macrocode}
337 \long\def\UTFviii@three@octets{%
338 \ifincsname
339 \expandafter \UTF@three@octets@string
340 \else
341 \ifx \protect\@typeset@protect \else
342 \expandafter\expandafter\expandafter \UTF@three@octets@noexpand
343 \fi
344 \fi
345 \UTFviii@three@octets@combine
346 }
347 % \end{macrocode}
348 % \begin{macrocode}
349 \long\def\UTFviii@four@octets{%
350 \ifincsname
351 \expandafter \UTF@four@octets@string
352 \else
353 \ifx \protect\@typeset@protect \else
354 \expandafter\expandafter\expandafter \UTF@four@octets@noexpand
355 \fi
356 \fi
357 \UTFviii@four@octets@combine
358 }
359 % \end{macrocode}
360 % \end{macro}
361 % \end{macro}
362 %
363 % \begin{macro}{\UTFviii@two@octets@noexpand}
364 % \begin{macro}{\UTFviii@three@octets@noexpand}
365 % \begin{macro}{\UTFviii@four@octets@noexpand}
366 % \changes{v1.3a}{2022/02/19}{Use \cs{unexpanded} rather than \cs{noexpand} so only takes one expansion step}%
367 % These temporarily prevent the active chars from expanding.
368 % \begin{macrocode}
369 \long\def\UTF@two@octets@noexpand#1#2#3{\unexpanded{#2#3}}
370 \long\def\UTF@three@octets@noexpand#1#2#3#4{\unexpanded{#2#3#4}}
371 \long\def\UTF@four@octets@noexpand#1#2#3#4#5{\unexpanded{#2#3#4#5}}
372 % \end{macrocode}
373 % \end{macro}
374 % \end{macro}
375 % \end{macro}
376
377 % \begin{macro}{\UTFviii@two@octets@string}
378 % \begin{macro}{\UTFviii@three@octets@string}
379 % \begin{macro}{\UTFviii@four@octets@string}
380 % \changes{v1.3a}{2022/02/19}{Use \cs{detokenize} rather than \cs{string} so only takes one expansion step}%
381 % And the same with \cs{string} for use in \cs{csname} constructions.
382 % \begin{macrocode}
383 \long\def\UTF@two@octets@string#1#2#3{\detokenize{#2#3}}
384 \long\def\UTF@three@octets@string#1#2#3#4{\detokenize{#2#3#4}}
385 \long\def\UTF@four@octets@string#1#2#3#4#5{\detokenize{#2#3#4#5}}
386 % \end{macrocode}
387 % \end{macro}
388 % \end{macro}
389 % \end{macro}
390
391
392 % \begin{macro}{\UTFviii@two@octets@combine}
393 % \begin{macro}{\UTFviii@three@octets@combine}
394 % \begin{macro}{\UTFviii@four@octets@combine}
395 % From the arguments a control sequence with a name of the form
396 % \verb=u8:#1#2...= is constructed where the |#i| ($i>1$) are the
397 % arguments and |#1| is the starting octet (as a \TeX{} active character
398 % token). Since some or even all of these characters are active
399 % we need to use |\string| when building
400 % the \cs{csname}.
401 %
402 % The \cs{csname} thus constructed can of course be undefined but to
403 % avoid producing an unhelpful low-level undefined command error we
404 % pass it to |\UTFviii@defined| which is responsible for producing
405 % a more sensible error message (not yet done!!). If, however, it is
406 % defined we simply execute the thing (which should then expand to
407 % an encoding specific internal \LaTeX{} form).
408 % \begin{macrocode}
409 \long\def\UTFviii@two@octets@combine#1#2{\expandafter
410 \UTFviii@defined\csname u8:\string#1\string#2\endcsname}
411 % \end{macrocode}
412 %
413 % \begin{macrocode}
414 \long\def\UTFviii@three@octets@combine#1#2#3{\expandafter
415 \UTFviii@defined\csname u8:\string#1\string#2\string#3\endcsname}
416 % \end{macrocode}
417 %
418 % \begin{macrocode}
419 \long\def\UTFviii@four@octets@combine#1#2#3#4{\expandafter
420 \UTFviii@defined\csname u8:\string#1\string#2\string#3\string#4\endcsname}
421 % \end{macrocode}
422 % \end{macro}
423 % \end{macro}
424 % \end{macro}
425 %
426 %
427 % \begin{macro}{\UTFviii@defined}
428 % This tests whether its argument is different from |\relax|: it
429 % either calls for a sensible error message (not done), or it gets
430 % the |\fi| out of the way (in case the command has arguments) and
431 % executes it.
432 % \begin{macrocode}
433 \def\UTFviii@defined#1{%
434 \ifx#1\relax
435 % \end{macrocode}
436 % Test if the sequence is invalid UTF-8 or valid UTF-8 but without
437 % a \LaTeX\ definition.
438 % \begin{macrocode}
439 \if\relax\expandafter\UTFviii@checkseq\string#1\relax\relax
440 % \end{macrocode}
441 % The endline character has a special definition within the
442 % inputenc package (it is gobbling spaces). For this reason we
443 % can't produce multiline strings without some precaution.
444 % \changes{v1.1b}{2004/02/09}{No newlines allowed in error messages}
445 % \changes{v1.1g}{2005/09/27}{Real spaces do not show up so use \cs{space}}
446 % \changes{v1.1o}{2015/08/28}{Show Unicode number of character in hex}
447 % \changes{v1.2a}{2018/03/24}{Error message improved for non-UTF-8 sequences}%
448 % \changes{v1.2m}{2021/06/08}{Normalize various error messages as kernel errors}
449 % \begin{macrocode}
450 \UTFviii@undefined@err{#1}%
451 % \end{macrocode}
452 %
453 % \begin{macrocode}
454 \else
455 \@latex@error{Invalid UTF-8 byte sequence (\expandafter
456 \@gobblefour\string#1)}%
457 \UTFviii@invalid@help
458 \fi
459 % \end{macrocode}
460 %
461 % \begin{macrocode}
462 \else\expandafter
463 #1%
464 \fi
465 }
466 % \end{macrocode}
467 % \end{macro}
468 %
469 % \begin{macro}{\UTFviii@invalid@err}
470 % \begin{macro}{\UTFviii@invalid@help}
471 % \changes{v1.2a}{2018/03/24}{Macro added}%
472 % \changes{v1.2f}{2018/10/05}{Show invalid byte in hex}%
473 % \begin{macrocode}
474 \def\UTFviii@invalid@err#1{%
475 \@latex@error{Invalid UTF-8 byte "\UTFviii@hexnumber{`#1}}%
476 \UTFviii@invalid@help}
477 % \end{macrocode}
478 %
479 % \begin{macrocode}
480 \def\UTFviii@invalid@help{%
481 The document does not appear to be in UTF-8 encoding.\MessageBreak
482 Try adding \noexpand\UseRawInputEncoding as the first line of the file\MessageBreak
483 or specify an encoding such as \noexpand\usepackage[latin1]{inputenc}\MessageBreak
484 in the document preamble.\MessageBreak
485 Alternatively, save the file in UTF-8 using your editor or another tool}
486 % \end{macrocode}
487 % \end{macro}
488 % \end{macro}
489 %
490 % \begin{macro}{\UTFviii@undefined@err}
491 % \changes{v1.2a}{2018/03/24}{Macro added}%
492 % \begin{macrocode}
493 \def\UTFviii@undefined@err#1{%
494 \@latex@error{Unicode character \expandafter
495 \UTFviii@splitcsname\string#1\relax
496 \MessageBreak
497 not set up for use with LaTeX}%
498 {You may provide a definition with\MessageBreak
499 \noexpand\DeclareUnicodeCharacter}%
500 }
501 % \end{macrocode}
502 % \end{macro}
503 %
504 %
505 % \begin{macro}{\UTFviii@checkseq}
506 % \begin{macro}{\UTFviii@check@continue}
507 % \changes{v1.2a}{2018/03/24}{Macro added}%
508 % Check that the csname consists of a valid UTF-8 sequence.
509 % \begin{macrocode}
510 \def\UTFviii@checkseq#1:#2#3{%
511 \ifnum`#2<"80 %
512 \ifx\relax#3\else1\fi
513 \else
514 \ifnum`#2<"C0 %
515 1 %
516 \else
517 \expandafter\expandafter\expandafter\UTFviii@check@continue
518 \expandafter\expandafter\expandafter#3%
519 \fi
520 \fi}
521 % \end{macrocode}
522 %
523 % \begin{macrocode}
524 \def\UTFviii@check@continue#1{%
525 \ifx\relax#1%
526 \else
527 \ifnum`#1<"80 1\else\ifnum`#1>"BF 1\fi\fi
528 \expandafter\UTFviii@check@continue
529 \fi
530 }
531 % \end{macrocode}
532 % \end{macro}
533 % \end{macro}
534 %
535 %
536 % \begin{macro}{\UTFviii@loop}
537 % This bit of code derived from \texttt{xmltex} defines the active
538 % character corresponding to starting octets to call |\UTFviii@two@octets|
539 % etc as appropriate.
540 % The starting octet itself is passed directly as the first
541 % argument, the others are picked up later en route.
542 %
543 % The |\UTFviii@loop| loops through the numbers starting at
544 % |\count@| and ending at |\@tempcnta|${} - 1$, each time executing
545 % the code in |\UTFviii@tmp|.
546 %
547 % Store current settings so can restore after the loops without using a group (gh/762).
548 %
549 % \begin{macrocode}
550 \edef\reserved@a{%
551 \catcode`\noexpand\~=\the\catcode`\~\relax
552 \catcode`\noexpand\"=\the\catcode`\"\relax
553 \uccode`\noexpand\~=\the\uccode`\~\relax
554 \count@=\the\count@\relax
555 \@tempcnta=\the\@tempcnta\relax
556 \let\noexpand\reserved@a\relax}
557 % \end{macrocode}
558 %
559 % \begin{macrocode}
560 \catcode`\~13
561 \catcode`\"12
562 % \end{macrocode}
563 %
564 % \changes{v1.3a}{2022/02/19}{Use local protected definitions in the character definitions}%
565 % \begin{macrocode}
566 \def\UTFviii@loop{%
567 \uccode`\~\count@
568 \uppercase\expandafter{\UTFviii@tmp}%
569 \advance\count@\@ne
570 \ifnum\count@<\@tempcnta
571 \expandafter\UTFviii@loop
572 \fi}
573 % \end{macrocode}
574 %
575 % Handle the single byte control characters.
576 % \changes{v1.2a}{2018/03/24}{Loop over C0 controls added}%
577 % C0 controls are valid UTF-8 but defined to give the ``Character not defined error''
578 % They may be defined with |\DeclareUnicodeCharacter|.
579 % \begin{macrocode}
580 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@undefined@err{:\string~}}}
581 % 0 ^^@ null
582 \count@"1
583 \@tempcnta9
584 % 9 ^^I tab
585 % 10 ^^J nl
586 \UTFviii@loop
587 \count@11
588 \@tempcnta12
589 \UTFviii@loop
590 % 12 ^^L
591 % 13 ^^M
592 \count@14
593 \@tempcnta32
594 \UTFviii@loop
595 % \end{macrocode}
596 %
597 %
598 % Bytes with leading bits |10| are not valid UTF-8 starting bytes
599 % \begin{macrocode}
600 \count@"80
601 \@tempcnta"C2
602 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@invalid@err\string~}}
603 \UTFviii@loop
604 % \end{macrocode}
605 %
606 % Setting up 2-byte UTF-8: The starting bytes is passed as an
607 % active character so that it can be reprocessed later!
608 % \begin{macrocode}
609 \count@"C2
610 \@tempcnta"E0
611 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@two@octets\noexpand~}}
612 \UTFviii@loop
613 % \end{macrocode}
614 %
615 % Setting up 3-byte UTF-8:
616 % \begin{macrocode}
617 \count@"E0
618 \@tempcnta"F0
619 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@three@octets\noexpand~}}
620 \UTFviii@loop
621 % \end{macrocode}
622 %
623 % Setting up 4-byte UTF-8:
624 % \changes{v1.2e}{2018/09/28}{Fix "F4 lead byte}%
625 % \begin{macrocode}
626 \count@"F0
627 \@tempcnta"F5
628 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@four@octets\noexpand~}}
629 \UTFviii@loop
630 % \end{macrocode}
631 %
632 % Bytes above F4 are not valid UTF-8 starting bytes as they would encode numbers beyond
633 % the Unicode range
634 % \begin{macrocode}
635 \count@"F5
636 \@tempcnta"100
637 \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@invalid@err\string~}}
638 \UTFviii@loop
639 % \end{macrocode}
640 %
641 % Restore values after the loops.
642 % \begin{macrocode}
643 \reserved@a
644 % \end{macrocode}
645 %
646 % \end{macro}
647 %
648 % For this case we must disable the warning generated by
649 % \texttt{inputenc} if it doesn't see any new |\DeclareInputText|
650 % commands.
651 % \begin{macrocode}
652 \@inpenc@test
653 % \end{macrocode}
654 %
655 %
656 % If this file (\texttt{utf8.def}) is not being read while setting
657 % up \texttt{inputenc}, i.e.~in the preamble, but when
658 % |\inputencoding| is called somewhere within the document, we do not
659 % need to input the specific Unicode mappings again. We therefore
660 % stop reading the file at this point.
661 % \begin{macrocode}
662 \ifx\@begindocumenthook\@undefined
663 \makeatother
664 % \end{macrocode}
665 % The |\fi| must be on the same line as |\endinput| or else it will
666 % never be seen!
667 % \begin{macrocode}
668 \endinput \fi
669 % \end{macrocode}
670 %
671 %
672 % \subsection{Mapping Unicode codes to \LaTeX{} internal forms}
673 %
674 %
675 % \begin{macro}{\DeclareUnicodeCharacter}
676 % The |\DeclareUnicodeCharacter| declaration defines a mapping from
677 % a Unicode character code point to a \LaTeX{} internal form. The first
678 % argument is the Unicode number as hexadecimal digits and the second is
679 % the actual \LaTeX{} internal form.
680 %
681 % We start by making sure that some characters have the right
682 % |\catcode| when they are used in the definitions below.
683 % \begin{macrocode}
684 \begingroup
685 \catcode`\"=12
686 \catcode`\<=12
687 \catcode`\.=12
688 \catcode`\,=12
689 \catcode`\;=12
690 \catcode`\!=12
691 \catcode`\~=13
692 % \end{macrocode}
693 %
694 % \begin{macrocode}
695 \gdef\DeclareUnicodeCharacter#1#2{%
696 \count@"#1\relax
697 \wlog{ \space\space defining Unicode char U+#1 (decimal \the\count@)}%
698 \begingroup
699 % \end{macrocode}
700 % Next we do the parsing of the number stored in |\count@| and assign the
701 % result to |\UTFviii@tmp|. Actually all this could be done in-line,
702 % the macro |\parse@XML@charref| is only there to extend this code
703 % to parsing Unicode numbers in other contexts one day (perhaps).
704 % \begin{macrocode}
705 \parse@XML@charref
706 % \end{macrocode}
707 %
708 % Here is an example of what is happening, for the pair \texttt{"C2 "A3}
709 % (which is the utf8 representation for the character \textsterling{}).
710 % After |\parse@XML@charref| we have, stored in |\UTFviii@tmp|, a
711 % single command with two character tokens as arguments:
712 % \begin{quote}
713 % [$t_{C2}$ and $t_{A3}$ are the characters corresponding to these
714 % two octets]\\
715 % |\UTFviii@two@octets| $t_{\rm C2}t_{\rm A3}$
716 % \end{quote}
717 % what we actually need to produce is a definition of the form
718 % \begin{quote}
719 % |\def\u8:|$t_{\rm C2}$$t_{\rm A3}$ |{|\textit{\LaTeX{} internal form}|}|\,.
720 % \end{quote}
721 % So here we temporarily redefine the prefix commands
722 % |\UTFviii@two@octets|, etc.~to
723 % generate the csname that we wish to define> the |\string|s are
724 % added in case these tokens are still active.
725 % \begin{macrocode}
726 \def\UTFviii@two@octets##1##2{\csname u8:##1\string##2\endcsname}%
727 \def\UTFviii@three@octets##1##2##3{\csname u8:##1%
728 \string##2\string##3\endcsname}%
729 \def\UTFviii@four@octets##1##2##3##4{\csname u8:##1%
730 \string##2\string##3\string##4\endcsname}%
731 % \end{macrocode}
732 % Now we simply:-) need to use the right number of |\expandafter|s to
733 % finally construct the definition: expanding |\UTFviii@tmp| once to get
734 % its contents, a second time to replace the prefix command by its
735 % |\csname| expansion, and a third time to turn the expansion into
736 % a csname after which the |\gdef| finally gets applied.
737 % We add an irrelevant |\IeC| and braces around the definition, in
738 % order to avoid any space after the command being gobbled up
739 % when the text is written out to an auxiliary file (see
740 % \texttt{inputenc} for further details
741 % \begin{macrocode}
742 \expandafter\expandafter\expandafter
743 \expandafter\expandafter\expandafter
744 \expandafter
745 \gdef\UTFviii@tmp{\IeC{#2}}%
746 \endgroup
747 }
748 % \end{macrocode}
749 % \end{macro}
750 %
751 %
752 % \begin{macro}{\parse@XML@charref}
753 % This macro parses a Unicode number (decimal) and returns its
754 % UTF-8 representation as a sequence of non-active \TeX{} character
755 % tokens. In the
756 % original code it had two arguments delimited by \texttt{;} here,
757 % however, we supply the Unicode number implicitly.
758 % \begin{macrocode}
759 \gdef\parse@XML@charref{%
760 % \end{macrocode}
761 % We need to keep a few things local, mainly the |\uccode|'s that
762 % are set up below. However, the group originally used here is
763 % actually unnecessary since we call this macro only within another
764 % group; but it will be important to restore the group if this
765 % macro gets used for other purposes.
766 % \begin{macrocode}
767 % \begingroup
768 % \end{macrocode}
769 % The original code from \texttt{xmltex} supported the convention that a
770 % Unicode slot number could be given either as a decimal or as a
771 % hexadecimal (by starting with \texttt{x}). We do not do this so
772 % this code is also removed. This could be reactivated if one
773 % wants to support document commands that accept Unicode numbers
774 % (but then the first case needs to be changed from an error
775 % message back to something more useful again).
776 % \begin{macrocode}
777 % \uppercase{\count@\if x\noexpand#1"\else#1\fi#2}\relax
778 % \end{macrocode}
779 % As |\count@| already contains the right value we make
780 % |\parse@XML@charref| work without arguments.
781 % \changes{v1.1g}{2005/09/27}{Real spaces do not show up so use \cs{space}}
782 % \changes{v1.2a}{2018/03/24}{Allow control characters if active}
783 % In the case single byte UTF-8 sequences, only allow definition if
784 % the character os already active. The definition of |\UTFviii@tmp|
785 % looks slightly strange but is designed for the sequence of |\expandafter|
786 % in |\DeclareUnicodeCharacter|.
787 %
788 % \changes{v1.2o}{2021/12/13}{Use 80 not A0 to test for single byte UTF-8}
789 % \begin{macrocode}
790 \ifnum\count@<"80\relax
791 \ifnum\catcode\count@=13
792 \uccode`\~=\count@\uppercase{\def\UTFviii@tmp{\@empty\@empty~}}%
793 \else
794 \@latex@error{Cannot define non-active Unicode char value < 0080}%
795 \@eha
796 \def\UTFviii@tmp{\UTFviii@tmp}%
797 \fi
798 % \end{macrocode}
799 % The code below is derived from \texttt{xmltex} and generates the UTF-8 byte sequence
800 % for the number in |\count@|.
801 %
802 % The reverse operation (just used in error messages)
803 % has now been added as \cs{decode@UTFviii}.
804 % \begin{macrocode}
805 \else\ifnum\count@<"800\relax
806 \parse@UTFviii@a,%
807 \parse@UTFviii@b C\UTFviii@two@octets.,%
808 \else\ifnum\count@<"10000\relax
809 \parse@UTFviii@a;%
810 \parse@UTFviii@a,%
811 \parse@UTFviii@b E\UTFviii@three@octets.{,;}%
812 \else
813 % \end{macrocode}
814 %
815 % Test added here for out of range values, the 4-octet definitions are still set up
816 % so that |\DeclareUnicodeCharacter| does something sensible if the user scrolls
817 % past this error.
818 % \begin{macrocode}
819 \ifnum\count@>"10FFFF\relax
820 \@latex@error
821 {\UTFviii@hexnumber\count@\space too large for Unicode}%
822 {Values between 0 and 10FFFF are permitted}%
823 \fi
824 % \end{macrocode}
825 %
826 % \begin{macrocode}
827 \parse@UTFviii@a;%
828 \parse@UTFviii@a,%
829 \parse@UTFviii@a!%
830 \parse@UTFviii@b F\UTFviii@four@octets.{!,;}%
831 \fi
832 \fi
833 \fi
834 % \endgroup
835 }
836 % \end{macrocode}
837 % \end{macro}
838 %
839 % \begin{macro}{\parse@UTFviii@a}
840 % \ldots so somebody else can document this part :-)
841 % \changes{v1.1b}{2004/02/09}{Space in the wrong place \cs{count @64}}
842 % \begin{macrocode}
843 \gdef\parse@UTFviii@a#1{%
844 \@tempcnta\count@
845 \divide\count@ 64
846 \@tempcntb\count@
847 \multiply\count@ 64
848 \advance\@tempcnta-\count@
849 \advance\@tempcnta 128
850 \uccode`#1\@tempcnta
851 \count@\@tempcntb}
852 % \end{macrocode}
853 % \end{macro}
854 %
855 % \begin{macro}{\parse@UTFviii@b}
856 % \ldots same here
857 % \begin{macrocode}
858 \gdef\parse@UTFviii@b#1#2#3#4{%
859 \advance\count@ "#10\relax
860 \uccode`#3\count@
861 \uppercase{\gdef\UTFviii@tmp{#2#3#4}}}
862 % \end{macrocode}
863 % \end{macro}
864 %
865 % \begin{macro}{\decode@UTFviii}
866 % \changes{v1.1o}{2015/08/28}{Macro added}
867 % In the reverse direction, take a sequence of octets(bytes)
868 % representing a character in UTF-8 and construct the Unicode number.
869 % The sequence is terminated by |\relax|.
870 %
871 % In this version, if the sequence is not valid UTF-8 you probably
872 % get a low level arithmetic error from |\numexpr| or stray characters
873 % at the end. Getting a better error message would be somewhat expensive.
874 % As the main use is for reporting characters in messages, this is done
875 % just using expansion, so |\numexpr| is used, A stub returning 0 is defined
876 % if |\numexpr| is not available.
877 % \begin{macrocode}
878 \ifx\numexpr\@undefined
879 % \end{macrocode}
880 %
881 % \begin{macrocode}
882 \gdef\decode@UTFviii#1{0}
883 % \end{macrocode}
884 %
885 % \begin{macrocode}
886 \else
887 % \end{macrocode}
888 %
889 % If the input is malformed UTF-8 there may not be enough closing
890 % \iffalse(\fi ) so
891 % add 5 so there are always some remaining then cleanup and remove
892 % any remaining ones at the end. This avoids |\numexpr| parse errors
893 % while outputting a package error.
894 % \begin{macrocode}
895 \gdef\decode@UTFviii#1\relax{%
896 \expandafter\UTFviii@cleanup
897 \the\numexpr\dec@de@UTFviii#1\relax)))))\@empty}
898 % \end{macrocode}
899 %
900 % \begin{macrocode}
901 \gdef\UTFviii@cleanup#1)#2\@empty{#1}
902 % \end{macrocode}
903 %
904 % \begin{macrocode}
905 \gdef\dec@de@UTFviii#1{%
906 \ifx\relax#1%
907 \else
908 \ifnum`#1>"EF
909 ((((`#1-"F0)%
910 \else
911 \ifnum`#1>"DF
912 (((`#1-"E0)%
913 \else
914 \ifnum`#1>"BF
915 ((`#1-"C0)%
916 \else
917 \ifnum`#1>"7F
918 )*64+(`#1-"80)%
919 \else
920 +`#1 %
921 \fi
922 \fi
923 \fi
924 \fi
925 \expandafter\dec@de@UTFviii
926 \fi}
927 % \end{macrocode}
928 %
929 % \begin{macrocode}
930 \fi
931 % \end{macrocode}
932 % \end{macro}
933 %
934 % \begin{macro}{\UTFviii@hexnumber}
935 % \changes{v1.1o}{2015/08/28}{Macro added}
936 % Convert a number to a sequence of uppercase hex digits.
937 % If |\numexpr| is not available, it returns its argument unchanged.
938 % \begin{macrocode}
939 \ifx\numexpr\@undefined
940 % \end{macrocode}
941 % \begin{macrocode}
942 \global\let\UTFviii@hexnumber\@firstofone
943 \global\UTFviii@hexdigit\hexnumber@
944 % \end{macrocode}
945 % \begin{macrocode}
946 \else
947 % \end{macrocode}
948 % \begin{macrocode}
949 \gdef\UTFviii@hexnumber#1{%
950 \ifnum#1>15 %
951 \expandafter\UTFviii@hexnumber\expandafter{\the\numexpr(#1-8)/16\relax}%
952 \fi
953 \UTFviii@hexdigit{\numexpr#1\ifnum#1>0-((#1-8)/16)*16\fi\relax}%
954 }
955 % \end{macrocode}
956 %
957 % Almost but not quite |\hexnumber@|.
958 % \begin{macrocode}
959 \gdef\UTFviii@hexdigit#1{\ifcase\numexpr#1\relax
960 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or
961 A\or B\or C\or D\or E\or F\fi}
962 % \end{macrocode}
963 %
964 % \begin{macrocode}
965 \fi
966 % \end{macrocode}
967 % \end{macro}
968 %
969 % \begin{macro}{\UTFviii@splitcsname}
970 % \changes{v1.1o}{2015/08/28}{Macro added}
971 % \begin{macro}{\UTFviii@hexcodepoint}
972 % \changes{v1.2e}{2018/09/28}{Macro added: Format codepoint properly}
973 % Split a csname representing a unicode character and return
974 % the character and the unicode number in hex.
975 % \begin{macrocode}
976 \gdef\UTFviii@hexcodepoint#1{U+%
977 \ifnum#1<16 0\fi
978 \ifnum#1<256 0\fi
979 \ifnum#1<4096 0\fi
980 \UTFviii@hexnumber{#1}%
981 }%
982 \gdef\UTFviii@splitcsname#1:#2\relax{%
983 % \end{macrocode}
984 % \changes{v1.2b}{2018/03/26}{add percent as \cs{endlinechar} not -1 in the format}%
985 % Need to pre-expand the argument to ensure cleanup in case of mal-formed UTF-8.
986 % \begin{macrocode}
987 #2 (\expandafter\UTFviii@hexcodepoint\expandafter{%
988 \the\numexpr\decode@UTFviii#2\relax})%
989 }
990 % \end{macrocode}
991 % \end{macro}
992 % \end{macro}
993 %
994 % \begin{macrocode}
995 \endgroup
996 % \end{macrocode}
997 %
998 % \begin{macrocode}
999 \@onlypreamble\DeclareUnicodeCharacter
1000 % \end{macrocode}
1001 % These are preamble only as long as we don't support Unicode
1002 % charrefs in documents.
1003 % \begin{macrocode}
1004 \@onlypreamble\parse@XML@charref
1005 \@onlypreamble\parse@UTFviii@a
1006 \@onlypreamble\parse@UTFviii@b
1007 % \end{macrocode}
1008 %
1009 %
1010 % \subsection{Loading Unicode mappings at begin document}
1011 %
1012 % The original plan was to set up the UTF-8 support at
1013 % |\begin{document}|; but then any text characters used in the preamble
1014 % (as people do even though advised against it) would fail in one way or
1015 % the other.
1016 % So the implementation was changed and the Unicode definition files
1017 % for already defined encodings are loaded here.
1018 %
1019 % We loop through all defined font encodings
1020 % (stored in |\cdp@list|) and for each load a file
1021 % \textit{name}\texttt{enc.dfu} if it exist. That file is then
1022 % supposed to contain |\DeclareUnicodeCharacter| declarations.
1023 % \begin{macrocode}
1024 \begingroup
1025 \def\cdp@elt#1#2#3#4{%
1026 \wlog{Now handling font encoding #1 ...}%
1027 \lowercase{%
1028 \InputIfFileExists{#1enc.dfu}}%
1029 {\wlog{... processing UTF-8 mapping file for font %
1030 encoding #1}%
1031 % \end{macrocode}
1032 % \changes{v1.1m}{2008/04/05}{Ensure we don't lose spaces in the log}
1033 % The previous line is written to the log with the newline char being
1034 % ignored (thus not producing a space). Therefore either everything has to
1035 % be on a single input line or some special care must be taken. From this
1036 % point on we ignore spaces again, i.e., while we are reading the
1037 % \texttt{.dfu} file. The |\endgroup| below will restore it again.
1038 % \changes{v1.1d}{2004/05/08}{Explicitly set catcode of space}
1039 % \changes{v1.1g}{2005/09/27}{We lost the ``false'' case}
1040 % \begin{macrocode}
1041 \catcode`\ 9\relax}%
1042 {\wlog{... no UTF-8 mapping file for font encoding #1}}%
1043 }
1044 \cdp@list
1045 \endgroup
1046 % \end{macrocode}
1047 % However, we don't know if there are font encodings still to be
1048 % loaded (either with \texttt{fontenc} or directly with |\input| by
1049 % some package). Font encoding files are loaded only if the
1050 % corresponding encoding has not been loaded yet, and they always
1051 % begin with |\DeclareFontEncoding|. We now redefine the internal
1052 % kernel version of the latter to load the Unicode file if available.
1053 %
1054 % \begin{macrocode}
1055 \def\DeclareFontEncoding@#1#2#3{%
1056 \expandafter
1057 \ifx\csname T@#1\endcsname\relax
1058 \def\cdp@elt{\noexpand\cdp@elt}%
1059 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
1060 {\default@family}{\default@series}%
1061 {\default@shape}}%
1062 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
1063 \begingroup
1064 \wlog{Now handling font encoding #1 ...}%
1065 \lowercase{%
1066 \InputIfFileExists{#1enc.dfu}}%
1067 {\wlog{... processing UTF-8 mapping file for font %
1068 encoding #1}}%
1069 {\wlog{... no UTF-8 mapping file for font encoding #1}}%
1070 \endgroup
1071 \else
1072 \@font@info{Redeclaring font encoding #1}%
1073 \fi
1074 \global\@namedef{T@#1}{#2}%
1075 \global\@namedef{M@#1}{\default@M#3}%
1076 \xdef\LastDeclaredEncoding{#1}%
1077 }
1078 %</utf8>
1079 % \end{macrocode}
1080 %
1081 %
1082 %
1083 % \section{Mapping characters ---\newline based on font (glyph) encodings}
1084 %
1085 % This section is a first attempt to provide Unicode definitions for
1086 % characters whose standard glyphs are currently provided by the
1087 % standard \LaTeX{} font-encodings |T1|, |OT1|, etc. They are by
1088 % no means completed and need checking.
1089 %
1090 % For example, one should check the already existing input encodings
1091 % for glyphs that may in fact be available and required,
1092 % e.g.~\texttt{latin4} has a number of glyphs with the |\=|
1093 % accent. Since the |T1| encoding does not provide such glyphs,
1094 % these characters are not listed below (yet).
1095 %
1096 % The list below was generated by looking at the current \LaTeX{} font
1097 % encoding files, e.g., \texttt{t1enc.def} and using the work by
1098 % Sebastian Rahtz (in \texttt{ucharacters.sty}) with a few
1099 % modifications. In combinations such as |\^\i| the preferred form
1100 % is that and not |\^i|.
1101 %
1102 % This list has been built from several sources, obviously including
1103 % the Unicode Standard itself. These sources include Passive \TeX{} by
1104 % Sebastian Rahtz, the \texttt{unicode}
1105 % package by Dominique P. G. Unruh (mainly for Latin encodings) and
1106 % \texttt{text4ht} by Eitan Gurari (for Cyrillic ones).
1107 %
1108 % Note that it strictly follows the Mittelbach principles for
1109 % input character encodings: thus it offers no support for using utf8
1110 % representations of math symbols such as $\times$ or $\div$ (in math mode).
1111 %
1112 %
1113 % \subsection{About the table itself}
1114 %
1115 % In addition to generating individual files, the table below is, at present,
1116 % a one-one (we think) partial relationship between the (ill-defined) set
1117 % of LICRs and the Unicode slots "0080 to "FFFF. At present these entries
1118 % are used only to define a collection of partial mappings from Unicode
1119 % slots to LICRs; each of these mappings becomes full if we add an exception
1120 % value (`not defined') to the set of LICRs.
1121 %
1122 % It is probably not essential for the relationship in the full table to be
1123 % one-one; this raises questions such as: the exact role of LICRs;
1124 % the formal relationships on the set of LICRs; the (non-mathematical)
1125 % relationship between
1126 % LICRs and Unicode (which has its own somewhat fuzzy equivalences);
1127 % and ultimately what a character is and what a character representation
1128 % and/or name is.
1129 %
1130 % It is unclear the extent to which entries in this table should
1131 % resemble the closely related ones in the 8-bit \texttt{inputenc} files.
1132 % The Unicode standard claims that the first 256 slots `are' ASCII and
1133 % Latin-1.
1134 %
1135 % Of course, \TeX{} itself typically does not treat even many perfectly
1136 % `normal text' 7-bit slots as text characters, so it is unclear
1137 % whether \LaTeX{} should even attempt to deal in any consistent way with
1138 % those Unicode slots that are not definitive text characters.
1139 %
1140 %
1141 % \subsection{The mapping table}
1142 %
1143 % \begingroup
1144 % \hfuzz=12pt ^^A just because
1145 %
1146 % Note that the first argument must be a hex-digit number greater
1147 % than \texttt{00BF} and at most \texttt{10FFFF}.
1148 %
1149 % There are few notes about inconsistencies etc at the end of the table.
1150 %
1151 % \changes{v1.1o}{2015/08/28}{Add U+00A0 and U+00AD}
1152 % \changes{v1.1q}{2015/12/02}{Add remaining latin uses of accents in T1}
1153 % \changes{v1.1r}{2015/12/03}{Add some more ogonek cases}
1154 % \changes{v1.1s}{2016/01/11}{Add some more caron and acute}
1155 % \changes{v1.1t}{2017/01/28}{Add caron combinations for GgYy}
1156 % \changes{v1.3c}{2022/06/07}{Fix \cs{guillemetleft} and \cs{guillemetright} also in dfu files (gh/65)}%
1157 % \begin{macrocode}
1158 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A0}{\nobreakspace}
1159 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A1}{\textexclamdown}
1160 %<all,ts1,ly1>\DeclareUnicodeCharacter{00A2}{\textcent}
1161 %<all,ts1,t1,ot1,ly1>\DeclareUnicodeCharacter{00A3}{\textsterling}
1162 %<all,x2,ts1,t2c,t2b,t2a,ly1,lcy>\DeclareUnicodeCharacter{00A4}{\textcurrency}
1163 %<all,ts1,ly1>\DeclareUnicodeCharacter{00A5}{\textyen}
1164 %<all,ts1,ly1>\DeclareUnicodeCharacter{00A6}{\textbrokenbar}
1165 %<all,x2,ts1,t2c,t2b,t2a,oms,ly1>\DeclareUnicodeCharacter{00A7}{\textsection}
1166 %<all,ts1>\DeclareUnicodeCharacter{00A8}{\textasciidieresis}
1167 %<all,ts1,utf8>\DeclareUnicodeCharacter{00A9}{\textcopyright}
1168 %<all,ts1,ly1,utf8>\DeclareUnicodeCharacter{00AA}{\textordfeminine}
1169 %<*all,x2,t2c,t2b,t2a,t1,ot2,ly1,lcy>
1170 %\DeclareUnicodeCharacter{00AB}{\guillemotleft} % wrong Adobe name
1171 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
1172 %</all,x2,t2c,t2b,t2a,t1,ot2,ly1,lcy>
1173 %<all,ts1>\DeclareUnicodeCharacter{00AC}{\textlnot}
1174 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00AD}{\-}
1175 %<all,ts1,ly1,utf8>\DeclareUnicodeCharacter{00AE}{\textregistered}
1176 %<all,ts1>\DeclareUnicodeCharacter{00AF}{\textasciimacron}
1177 %<all,ts1,ly1>\DeclareUnicodeCharacter{00B0}{\textdegree}
1178 %<all,ts1>\DeclareUnicodeCharacter{00B1}{\textpm}
1179 %<all,ts1>\DeclareUnicodeCharacter{00B2}{\texttwosuperior}
1180 %<all,ts1>\DeclareUnicodeCharacter{00B3}{\textthreesuperior}
1181 %<all,ts1>\DeclareUnicodeCharacter{00B4}{\textasciiacute}
1182 %<all,ts1,ly1>\DeclareUnicodeCharacter{00B5}{\textmu} % micro sign
1183 %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{00B6}{\textparagraph}
1184 %<all,oms,ts1,ly1>\DeclareUnicodeCharacter{00B7}{\textperiodcentered}
1185 %<all,ot1>\DeclareUnicodeCharacter{00B8}{\c\ }
1186 %<all,ts1>\DeclareUnicodeCharacter{00B9}{\textonesuperior}
1187 %<all,ts1,ly1,utf8>\DeclareUnicodeCharacter{00BA}{\textordmasculine}
1188 %<*all,x2,t2c,t2b,t2a,t1,ot2,ly1,lcy>
1189 %\DeclareUnicodeCharacter{00BB}{\guillemotright} % wrong Adobe name
1190 \DeclareUnicodeCharacter{00BB}{\guillemetright}
1191 %</all,x2,t2c,t2b,t2a,t1,ot2,ly1,lcy>
1192 %<all,ts1,ly1>\DeclareUnicodeCharacter{00BC}{\textonequarter}
1193 %<all,ts1,ly1>\DeclareUnicodeCharacter{00BD}{\textonehalf}
1194 %<all,ts1,ly1>\DeclareUnicodeCharacter{00BE}{\textthreequarters}
1195 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00BF}{\textquestiondown}
1196 %<all,t1,ly1>\DeclareUnicodeCharacter{00C0}{\@tabacckludge`A}
1197 %<all,t1,ly1>\DeclareUnicodeCharacter{00C1}{\@tabacckludge'A}
1198 %<all,t1,ly1>\DeclareUnicodeCharacter{00C2}{\^A}
1199 %<all,t1,ly1>\DeclareUnicodeCharacter{00C3}{\~A}
1200 %<all,t1,ly1>\DeclareUnicodeCharacter{00C4}{\"A}
1201 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00C5}{\r A}
1202 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{00C6}{\AE}
1203 %<all,t1,ly1>\DeclareUnicodeCharacter{00C7}{\c C}
1204 %<all,t1,ly1>\DeclareUnicodeCharacter{00C8}{\@tabacckludge`E}
1205 %<all,t1,ly1>\DeclareUnicodeCharacter{00C9}{\@tabacckludge'E}
1206 %<all,t1,ly1>\DeclareUnicodeCharacter{00CA}{\^E}
1207 %<all,t1,ly1>\DeclareUnicodeCharacter{00CB}{\"E}
1208 %<all,t1,ly1>\DeclareUnicodeCharacter{00CC}{\@tabacckludge`I}
1209 %<all,t1,ly1>\DeclareUnicodeCharacter{00CD}{\@tabacckludge'I}
1210 %<all,t1,ly1>\DeclareUnicodeCharacter{00CE}{\^I}
1211 %<all,t1,ly1>\DeclareUnicodeCharacter{00CF}{\"I}
1212 %<all,t1,ly1>\DeclareUnicodeCharacter{00D0}{\DH}
1213 %<all,t1,ly1>\DeclareUnicodeCharacter{00D1}{\~N}
1214 %<all,t1,ly1>\DeclareUnicodeCharacter{00D2}{\@tabacckludge`O}
1215 %<all,t1,ly1>\DeclareUnicodeCharacter{00D3}{\@tabacckludge'O}
1216 %<all,t1,ly1>\DeclareUnicodeCharacter{00D4}{\^O}
1217 %<all,t1,ly1>\DeclareUnicodeCharacter{00D5}{\~O}
1218 %<all,t1,ly1>\DeclareUnicodeCharacter{00D6}{\"O}
1219 %<all,ts1>\DeclareUnicodeCharacter{00D7}{\texttimes}
1220 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{00D8}{\O}
1221 %<all,t1,ly1>\DeclareUnicodeCharacter{00D9}{\@tabacckludge`U}
1222 %<all,t1,ly1>\DeclareUnicodeCharacter{00DA}{\@tabacckludge'U}
1223 %<all,t1,ly1>\DeclareUnicodeCharacter{00DB}{\^U}
1224 %<all,t1,ly1>\DeclareUnicodeCharacter{00DC}{\"U}
1225 %<all,t1,ly1>\DeclareUnicodeCharacter{00DD}{\@tabacckludge'Y}
1226 %<all,t1,ly1>\DeclareUnicodeCharacter{00DE}{\TH}
1227 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{00DF}{\ss}
1228 %<all,t1,ly1>\DeclareUnicodeCharacter{00E0}{\@tabacckludge`a}
1229 %<all,t1,ly1>\DeclareUnicodeCharacter{00E1}{\@tabacckludge'a}
1230 %<all,t1,ly1>\DeclareUnicodeCharacter{00E2}{\^a}
1231 %<all,t1,ly1>\DeclareUnicodeCharacter{00E3}{\~a}
1232 %<all,t1,ly1>\DeclareUnicodeCharacter{00E4}{\"a}
1233 %<all,t1,ly1>\DeclareUnicodeCharacter{00E5}{\r a}
1234 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{00E6}{\ae}
1235 %<all,t1,ly1>\DeclareUnicodeCharacter{00E7}{\c c}
1236 %<all,t1,ly1>\DeclareUnicodeCharacter{00E8}{\@tabacckludge`e}
1237 %<all,t1,ly1>\DeclareUnicodeCharacter{00E9}{\@tabacckludge'e}
1238 %<all,t1,ly1>\DeclareUnicodeCharacter{00EA}{\^e}
1239 %<all,t1,ly1>\DeclareUnicodeCharacter{00EB}{\"e}
1240 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00EC}{\@tabacckludge`\i}
1241 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00ED}{\@tabacckludge'\i}
1242 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00EE}{\^\i}
1243 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00EF}{\"\i}
1244 %<all,t1,ly1>\DeclareUnicodeCharacter{00F0}{\dh}
1245 %<all,t1,ly1>\DeclareUnicodeCharacter{00F1}{\~n}
1246 %<all,t1,ly1>\DeclareUnicodeCharacter{00F2}{\@tabacckludge`o}
1247 %<all,t1,ly1>\DeclareUnicodeCharacter{00F3}{\@tabacckludge'o}
1248 %<all,t1,ly1>\DeclareUnicodeCharacter{00F4}{\^o}
1249 %<all,t1,ly1>\DeclareUnicodeCharacter{00F5}{\~o}
1250 %<all,t1,ly1>\DeclareUnicodeCharacter{00F6}{\"o}
1251 %<all,ts1>\DeclareUnicodeCharacter{00F7}{\textdiv}
1252 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{00F8}{\o}
1253 %<all,t1,ly1>\DeclareUnicodeCharacter{00F9}{\@tabacckludge`u}
1254 %<all,t1,ly1>\DeclareUnicodeCharacter{00FA}{\@tabacckludge'u}
1255 %<all,t1,ly1>\DeclareUnicodeCharacter{00FB}{\^u}
1256 %<all,t1,ly1>\DeclareUnicodeCharacter{00FC}{\"u}
1257 %<all,t1,ly1>\DeclareUnicodeCharacter{00FD}{\@tabacckludge'y}
1258 %<all,t1,ly1>\DeclareUnicodeCharacter{00FE}{\th}
1259 %<all,t1,ly1>\DeclareUnicodeCharacter{00FF}{\"y}
1260 %<all,t1>\DeclareUnicodeCharacter{0100}{\@tabacckludge=A}
1261 %<all,t1>\DeclareUnicodeCharacter{0101}{\@tabacckludge=a}
1262 %<all,t1>\DeclareUnicodeCharacter{0102}{\u A}
1263 %<all,t1>\DeclareUnicodeCharacter{0103}{\u a}
1264 %<all,t1>\DeclareUnicodeCharacter{0104}{\k A}
1265 %<all,t1>\DeclareUnicodeCharacter{0105}{\k a}
1266 %<all,t1>\DeclareUnicodeCharacter{0106}{\@tabacckludge'C}
1267 %<all,t1>\DeclareUnicodeCharacter{0107}{\@tabacckludge'c}
1268 %<all,t1>\DeclareUnicodeCharacter{0108}{\^C}
1269 %<all,t1>\DeclareUnicodeCharacter{0109}{\^c}
1270 %<all,t1>\DeclareUnicodeCharacter{010A}{\.C}
1271 %<all,t1>\DeclareUnicodeCharacter{010B}{\.c}
1272 %<all,t1>\DeclareUnicodeCharacter{010C}{\v C}
1273 %<all,t1>\DeclareUnicodeCharacter{010D}{\v c}
1274 %<all,t1>\DeclareUnicodeCharacter{010E}{\v D}
1275 %<all,t1>\DeclareUnicodeCharacter{010F}{\v d}
1276 %<all,t1>\DeclareUnicodeCharacter{0110}{\DJ}
1277 %<all,t1>\DeclareUnicodeCharacter{0111}{\dj}
1278 %<all,t1>\DeclareUnicodeCharacter{0112}{\@tabacckludge=E}
1279 %<all,t1>\DeclareUnicodeCharacter{0113}{\@tabacckludge=e}
1280 %<all,t1>\DeclareUnicodeCharacter{0114}{\u E}
1281 %<all,t1>\DeclareUnicodeCharacter{0115}{\u e}
1282 %<all,t1>\DeclareUnicodeCharacter{0116}{\.E}
1283 %<all,t1>\DeclareUnicodeCharacter{0117}{\.e}
1284 %<all,t1>\DeclareUnicodeCharacter{0118}{\k E}
1285 %<all,t1>\DeclareUnicodeCharacter{0119}{\k e}
1286 %<all,t1>\DeclareUnicodeCharacter{011A}{\v E}
1287 %<all,t1>\DeclareUnicodeCharacter{011B}{\v e}
1288 %<all,t1>\DeclareUnicodeCharacter{011C}{\^G}
1289 %<all,t1>\DeclareUnicodeCharacter{011D}{\^g}
1290 %<all,t1>\DeclareUnicodeCharacter{011E}{\u G}
1291 %<all,t1>\DeclareUnicodeCharacter{011F}{\u g}
1292 %<all,t1>\DeclareUnicodeCharacter{0120}{\.G}
1293 %<all,t1>\DeclareUnicodeCharacter{0121}{\.g}
1294 %<all,t1>\DeclareUnicodeCharacter{0122}{\c G}
1295 %<all,t1>\DeclareUnicodeCharacter{0123}{\c g}
1296 %<all,t1>\DeclareUnicodeCharacter{0124}{\^H}
1297 %<all,t1>\DeclareUnicodeCharacter{0125}{\^h}
1298 %<all,t1>\DeclareUnicodeCharacter{0128}{\~I}
1299 %<all,t1>\DeclareUnicodeCharacter{0129}{\~\i}
1300 %<all,t1>\DeclareUnicodeCharacter{012A}{\@tabacckludge=I}
1301 %<all,t1>\DeclareUnicodeCharacter{012B}{\@tabacckludge=\i}
1302 %<all,t1>\DeclareUnicodeCharacter{012C}{\u I}
1303 %<all,t1>\DeclareUnicodeCharacter{012D}{\u\i}
1304 %<all,t1>\DeclareUnicodeCharacter{012E}{\k I}
1305 % \end{macrocode}
1306 % \changes{v1.2g}{2019/02/06}{Corrected 012F (github/122)}
1307 % \begin{macrocode}
1308 %<all,t1>\DeclareUnicodeCharacter{012F}{\k i}
1309 %<all,t1>\DeclareUnicodeCharacter{0130}{\.I}
1310 %<all,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>\DeclareUnicodeCharacter{0131}{\i}
1311 %<all,t1>\DeclareUnicodeCharacter{0132}{\IJ}
1312 %<all,t1>\DeclareUnicodeCharacter{0133}{\ij}
1313 %<all,t1>\DeclareUnicodeCharacter{0134}{\^J}
1314 %<all,t1>\DeclareUnicodeCharacter{0135}{\^\j}
1315 %<all,t1>\DeclareUnicodeCharacter{0136}{\c K}
1316 %<all,t1>\DeclareUnicodeCharacter{0137}{\c k}
1317 %<all,t1>\DeclareUnicodeCharacter{0139}{\@tabacckludge'L}
1318 %<all,t1>\DeclareUnicodeCharacter{013A}{\@tabacckludge'l}
1319 %<all,t1>\DeclareUnicodeCharacter{013B}{\c L}
1320 %<all,t1>\DeclareUnicodeCharacter{013C}{\c l}
1321 %<all,t1>\DeclareUnicodeCharacter{013D}{\v L}
1322 %<all,t1>\DeclareUnicodeCharacter{013E}{\v l}
1323 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0141}{\L}
1324 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0142}{\l}
1325 %<all,t1>\DeclareUnicodeCharacter{0143}{\@tabacckludge'N}
1326 %<all,t1>\DeclareUnicodeCharacter{0144}{\@tabacckludge'n}
1327 %<all,t1>\DeclareUnicodeCharacter{0145}{\c N}
1328 %<all,t1>\DeclareUnicodeCharacter{0146}{\c n}
1329 %<all,t1>\DeclareUnicodeCharacter{0147}{\v N}
1330 %<all,t1>\DeclareUnicodeCharacter{0148}{\v n}
1331 %<all,t1>\DeclareUnicodeCharacter{014A}{\NG}
1332 %<all,t1>\DeclareUnicodeCharacter{014B}{\ng}
1333 %<all,t1>\DeclareUnicodeCharacter{014C}{\@tabacckludge=O}
1334 %<all,t1>\DeclareUnicodeCharacter{014D}{\@tabacckludge=o}
1335 %<all,t1>\DeclareUnicodeCharacter{014E}{\u O}
1336 %<all,t1>\DeclareUnicodeCharacter{014F}{\u o}
1337 %<all,t1>\DeclareUnicodeCharacter{0150}{\H O}
1338 %<all,t1>\DeclareUnicodeCharacter{0151}{\H o}
1339 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{0152}{\OE}
1340 %<all,t1,ot1,ly1,lcy>\DeclareUnicodeCharacter{0153}{\oe}
1341 %<all,t1>\DeclareUnicodeCharacter{0154}{\@tabacckludge'R}
1342 %<all,t1>\DeclareUnicodeCharacter{0155}{\@tabacckludge'r}
1343 %<all,t1>\DeclareUnicodeCharacter{0156}{\c R}
1344 %<all,t1>\DeclareUnicodeCharacter{0157}{\c r}
1345 %<all,t1>\DeclareUnicodeCharacter{0158}{\v R}
1346 %<all,t1>\DeclareUnicodeCharacter{0159}{\v r}
1347 %<all,t1>\DeclareUnicodeCharacter{015A}{\@tabacckludge'S}
1348 %<all,t1>\DeclareUnicodeCharacter{015B}{\@tabacckludge's}
1349 %<all,t1>\DeclareUnicodeCharacter{015C}{\^S}
1350 %<all,t1>\DeclareUnicodeCharacter{015D}{\^s}
1351 %<all,t1>\DeclareUnicodeCharacter{015E}{\c S}
1352 %<all,t1>\DeclareUnicodeCharacter{015F}{\c s}
1353 %<all,t1,ly1>\DeclareUnicodeCharacter{0160}{\v S}
1354 %<all,t1,ly1>\DeclareUnicodeCharacter{0161}{\v s}
1355 %<all,t1>\DeclareUnicodeCharacter{0162}{\c T}
1356 %<all,t1>\DeclareUnicodeCharacter{0163}{\c t}
1357 %<all,t1>\DeclareUnicodeCharacter{0164}{\v T}
1358 %<all,t1>\DeclareUnicodeCharacter{0165}{\v t}
1359 %<all,t1>\DeclareUnicodeCharacter{0168}{\~U}
1360 %<all,t1>\DeclareUnicodeCharacter{0169}{\~u}
1361 %<all,t1>\DeclareUnicodeCharacter{016A}{\@tabacckludge=U}
1362 %<all,t1>\DeclareUnicodeCharacter{016B}{\@tabacckludge=u}
1363 %<all,t1>\DeclareUnicodeCharacter{016C}{\u U}
1364 %<all,t1>\DeclareUnicodeCharacter{016D}{\u u}
1365 %<all,t1>\DeclareUnicodeCharacter{016E}{\r U}
1366 %<all,t1>\DeclareUnicodeCharacter{016F}{\r u}
1367 %<all,t1>\DeclareUnicodeCharacter{0170}{\H U}
1368 %<all,t1>\DeclareUnicodeCharacter{0171}{\H u}
1369 %<all,t1>\DeclareUnicodeCharacter{0172}{\k U}
1370 %<all,t1>\DeclareUnicodeCharacter{0173}{\k u}
1371 % \end{macrocode}
1372 %
1373 % \changes{v1.1p}{2015/09/07}{Welsh circumflex combinations}
1374 % \begin{macrocode}
1375 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0174}{\^W}
1376 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0175}{\^w}
1377 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0176}{\^Y}
1378 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0177}{\^y}
1379 %<all,t1,ly1>\DeclareUnicodeCharacter{0178}{\"Y}
1380 %<all,t1>\DeclareUnicodeCharacter{0179}{\@tabacckludge'Z}
1381 %<all,t1>\DeclareUnicodeCharacter{017A}{\@tabacckludge'z}
1382 %<all,t1>\DeclareUnicodeCharacter{017B}{\.Z}
1383 %<all,t1>\DeclareUnicodeCharacter{017C}{\.z}
1384 %<all,t1,ly1>\DeclareUnicodeCharacter{017D}{\v Z}
1385 %<all,t1,ly1>\DeclareUnicodeCharacter{017E}{\v z}
1386 %<all,ts1,ly1>\DeclareUnicodeCharacter{0192}{\textflorin}
1387 % \end{macrocode}
1388 % \changes{v1.2n}{2021/12/10}{add 01C4-01CC}
1389 % \begin{macrocode}
1390 %<all,t1>\DeclareUnicodeCharacter{01C4}{D\v Z}
1391 %<all,t1>\DeclareUnicodeCharacter{01C5}{D\v z}
1392 %<all,t1>\DeclareUnicodeCharacter{01C6}{d\v z}
1393 %<all,t1>\DeclareUnicodeCharacter{01C7}{LJ}
1394 %<all,t1>\DeclareUnicodeCharacter{01C8}{Lj}
1395 %<all,t1>\DeclareUnicodeCharacter{01C9}{lj}
1396 %<all,t1>\DeclareUnicodeCharacter{01CA}{NJ}
1397 %<all,t1>\DeclareUnicodeCharacter{01CB}{Nj}
1398 %<all,t1>\DeclareUnicodeCharacter{01CC}{nj}
1399 % \end{macrocode}
1400 % \changes{v1.1s}{2016/01/11}{add 01CD-01F4}
1401 % \begin{macrocode}
1402 %<all,t1>\DeclareUnicodeCharacter{01CD}{\v A}
1403 %<all,t1>\DeclareUnicodeCharacter{01CE}{\v a}
1404 %<all,t1>\DeclareUnicodeCharacter{01CF}{\v I}
1405 %<all,t1>\DeclareUnicodeCharacter{01D0}{\v \i}
1406 %<all,t1>\DeclareUnicodeCharacter{01D1}{\v O}
1407 %<all,t1>\DeclareUnicodeCharacter{01D2}{\v o}
1408 %<all,t1>\DeclareUnicodeCharacter{01D3}{\v U}
1409 %<all,t1>\DeclareUnicodeCharacter{01D4}{\v u}
1410 %<all,t1>\DeclareUnicodeCharacter{01E2}{\@tabacckludge=\AE}
1411 %<all,t1>\DeclareUnicodeCharacter{01E3}{\@tabacckludge=\ae}
1412 %<all,t1>\DeclareUnicodeCharacter{01E6}{\v G}
1413 %<all,t1>\DeclareUnicodeCharacter{01E7}{\v g}
1414 %<all,t1>\DeclareUnicodeCharacter{01E8}{\v K}
1415 %<all,t1>\DeclareUnicodeCharacter{01E9}{\v k}
1416 %<all,t1>\DeclareUnicodeCharacter{01EA}{\k O}
1417 %<all,t1>\DeclareUnicodeCharacter{01EB}{\k o}
1418 %<all,t1>\DeclareUnicodeCharacter{01F0}{\v\j}
1419 %<all,t1>\DeclareUnicodeCharacter{01F4}{\@tabacckludge'G}
1420 %<all,t1>\DeclareUnicodeCharacter{01F5}{\@tabacckludge'g}
1421 % \end{macrocode}
1422 % \changes{v1.1o}{2015/08/28}{comma accent latex/4414}
1423 % \begin{macrocode}
1424 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0218}{\textcommabelow S}
1425 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0219}{\textcommabelow s}
1426 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{021A}{\textcommabelow T}
1427 %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{021B}{\textcommabelow t}
1428 % \end{macrocode}
1429 %
1430 % \begin{macrocode}
1431 %<all,t1>\DeclareUnicodeCharacter{0232}{\@tabacckludge=Y}
1432 %<all,t1>\DeclareUnicodeCharacter{0233}{\@tabacckludge=y}
1433 %<all,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>\DeclareUnicodeCharacter{0237}{\j}
1434 %<all,ly1,utf8>\DeclareUnicodeCharacter{02C6}{\textasciicircum}
1435 %<all,ts1>\DeclareUnicodeCharacter{02C7}{\textasciicaron}
1436 %<all,ly1,utf8>\DeclareUnicodeCharacter{02DC}{\textasciitilde}
1437 %<all,ts1>\DeclareUnicodeCharacter{02D8}{\textasciibreve}
1438 %<all,t1>\DeclareUnicodeCharacter{02D9}{\.{}}
1439 %<all,t1>\DeclareUnicodeCharacter{02DB}{\k{}}
1440 %<all,ts1>\DeclareUnicodeCharacter{02DD}{\textacutedbl}
1441 % \end{macrocode}
1442 % The Cyrillic code points have been recently checked (2007) and extended
1443 % and corrected by Matthias Noe (\[email protected]=) --- thanks.
1444 % \changes{v1.1j}{2007/11/09}{Added a few new unicode decls in cyrillic (pr/3988)}
1445 % \changes{v1.1k}{2007/11/11}{Added and further unicode decls in cyrillic}
1446 % \changes{v1.1n}{2015/06/27}{correct accent https://tex.stackexchange.com/q/252521}
1447 % \begin{macrocode}
1448 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1449 \DeclareUnicodeCharacter{0400}{\@tabacckludge`\CYRE}
1450 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1451 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{0401}{\CYRYO}
1452 %<all,x2,t2a,ot2>\DeclareUnicodeCharacter{0402}{\CYRDJE}
1453 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1454 \DeclareUnicodeCharacter{0403}{\@tabacckludge'\CYRG}
1455 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1456 %<all,x2,t2a,ot2,lcy>\DeclareUnicodeCharacter{0404}{\CYRIE}
1457 %<all,x2,t2c,t2b,t2a,ot2>\DeclareUnicodeCharacter{0405}{\CYRDZE}
1458 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{0406}{\CYRII}
1459 %<all,x2,t2a,lcy>\DeclareUnicodeCharacter{0407}{\CYRYI}
1460 %<all,x2,t2c,t2b,t2a,ot2>\DeclareUnicodeCharacter{0408}{\CYRJE}
1461 %<all,x2,t2b,t2a,ot2>\DeclareUnicodeCharacter{0409}{\CYRLJE}
1462 %<all,x2,t2b,t2a,ot2>\DeclareUnicodeCharacter{040A}{\CYRNJE}
1463 %<all,x2,t2a,ot2>\DeclareUnicodeCharacter{040B}{\CYRTSHE}
1464 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1465 \DeclareUnicodeCharacter{040C}{\@tabacckludge'\CYRK}
1466 \DeclareUnicodeCharacter{040D}{\@tabacckludge`\CYRI}
1467 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1468 %<all,x2,t2b,t2a,lcy>\DeclareUnicodeCharacter{040E}{\CYRUSHRT}
1469 %<all,x2,t2c,t2a,ot2>\DeclareUnicodeCharacter{040F}{\CYRDZHE}
1470 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1471 \DeclareUnicodeCharacter{0410}{\CYRA}
1472 \DeclareUnicodeCharacter{0411}{\CYRB}
1473 \DeclareUnicodeCharacter{0412}{\CYRV}
1474 \DeclareUnicodeCharacter{0413}{\CYRG}
1475 \DeclareUnicodeCharacter{0414}{\CYRD}
1476 \DeclareUnicodeCharacter{0415}{\CYRE}
1477 \DeclareUnicodeCharacter{0416}{\CYRZH}
1478 \DeclareUnicodeCharacter{0417}{\CYRZ}
1479 \DeclareUnicodeCharacter{0418}{\CYRI}
1480 \DeclareUnicodeCharacter{0419}{\CYRISHRT}
1481 \DeclareUnicodeCharacter{041A}{\CYRK}
1482 \DeclareUnicodeCharacter{041B}{\CYRL}
1483 \DeclareUnicodeCharacter{041C}{\CYRM}
1484 \DeclareUnicodeCharacter{041D}{\CYRN}
1485 \DeclareUnicodeCharacter{041E}{\CYRO}
1486 \DeclareUnicodeCharacter{041F}{\CYRP}
1487 \DeclareUnicodeCharacter{0420}{\CYRR}
1488 \DeclareUnicodeCharacter{0421}{\CYRS}
1489 \DeclareUnicodeCharacter{0422}{\CYRT}
1490 \DeclareUnicodeCharacter{0423}{\CYRU}
1491 \DeclareUnicodeCharacter{0424}{\CYRF}
1492 \DeclareUnicodeCharacter{0425}{\CYRH}
1493 \DeclareUnicodeCharacter{0426}{\CYRC}
1494 \DeclareUnicodeCharacter{0427}{\CYRCH}
1495 \DeclareUnicodeCharacter{0428}{\CYRSH}
1496 \DeclareUnicodeCharacter{0429}{\CYRSHCH}
1497 \DeclareUnicodeCharacter{042A}{\CYRHRDSN}
1498 \DeclareUnicodeCharacter{042B}{\CYRERY}
1499 \DeclareUnicodeCharacter{042C}{\CYRSFTSN}
1500 \DeclareUnicodeCharacter{042D}{\CYREREV}
1501 \DeclareUnicodeCharacter{042E}{\CYRYU}
1502 \DeclareUnicodeCharacter{042F}{\CYRYA}
1503 \DeclareUnicodeCharacter{0430}{\cyra}
1504 \DeclareUnicodeCharacter{0431}{\cyrb}
1505 \DeclareUnicodeCharacter{0432}{\cyrv}
1506 \DeclareUnicodeCharacter{0433}{\cyrg}
1507 \DeclareUnicodeCharacter{0434}{\cyrd}
1508 \DeclareUnicodeCharacter{0435}{\cyre}
1509 \DeclareUnicodeCharacter{0436}{\cyrzh}
1510 \DeclareUnicodeCharacter{0437}{\cyrz}
1511 \DeclareUnicodeCharacter{0438}{\cyri}
1512 \DeclareUnicodeCharacter{0439}{\cyrishrt}
1513 \DeclareUnicodeCharacter{043A}{\cyrk}
1514 \DeclareUnicodeCharacter{043B}{\cyrl}
1515 \DeclareUnicodeCharacter{043C}{\cyrm}
1516 \DeclareUnicodeCharacter{043D}{\cyrn}
1517 \DeclareUnicodeCharacter{043E}{\cyro}
1518 \DeclareUnicodeCharacter{043F}{\cyrp}
1519 \DeclareUnicodeCharacter{0440}{\cyrr}
1520 \DeclareUnicodeCharacter{0441}{\cyrs}
1521 \DeclareUnicodeCharacter{0442}{\cyrt}
1522 \DeclareUnicodeCharacter{0443}{\cyru}
1523 \DeclareUnicodeCharacter{0444}{\cyrf}
1524 \DeclareUnicodeCharacter{0445}{\cyrh}
1525 \DeclareUnicodeCharacter{0446}{\cyrc}
1526 \DeclareUnicodeCharacter{0447}{\cyrch}
1527 \DeclareUnicodeCharacter{0448}{\cyrsh}
1528 \DeclareUnicodeCharacter{0449}{\cyrshch}
1529 \DeclareUnicodeCharacter{044A}{\cyrhrdsn}
1530 \DeclareUnicodeCharacter{044B}{\cyrery}
1531 \DeclareUnicodeCharacter{044C}{\cyrsftsn}
1532 \DeclareUnicodeCharacter{044D}{\cyrerev}
1533 \DeclareUnicodeCharacter{044E}{\cyryu}
1534 \DeclareUnicodeCharacter{044F}{\cyrya}
1535 \DeclareUnicodeCharacter{0450}{\@tabacckludge`\cyre}
1536 \DeclareUnicodeCharacter{0451}{\cyryo}
1537 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1538 %<all,x2,t2a,ot2>\DeclareUnicodeCharacter{0452}{\cyrdje}
1539 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1540 \DeclareUnicodeCharacter{0453}{\@tabacckludge'\cyrg}
1541 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1542 %<all,x2,t2a,ot2,lcy>\DeclareUnicodeCharacter{0454}{\cyrie}
1543 %<all,x2,t2c,t2b,t2a,ot2>\DeclareUnicodeCharacter{0455}{\cyrdze}
1544 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{0456}{\cyrii}
1545 %<all,x2,t2a,lcy>\DeclareUnicodeCharacter{0457}{\cyryi}
1546 %<all,x2,t2c,t2b,t2a,ot2>\DeclareUnicodeCharacter{0458}{\cyrje}
1547 %<all,x2,t2b,t2a,ot2>\DeclareUnicodeCharacter{0459}{\cyrlje}
1548 %<all,x2,t2b,t2a,ot2>\DeclareUnicodeCharacter{045A}{\cyrnje}
1549 %<all,x2,t2a,ot2>\DeclareUnicodeCharacter{045B}{\cyrtshe}
1550 %<*all,x2,t2c,t2b,t2a,ot2,lcy>
1551 \DeclareUnicodeCharacter{045C}{\@tabacckludge'\cyrk}
1552 \DeclareUnicodeCharacter{045D}{\@tabacckludge`\cyri}
1553 %</all,x2,t2c,t2b,t2a,ot2,lcy>
1554 %<all,x2,t2b,t2a,lcy>\DeclareUnicodeCharacter{045E}{\cyrushrt}
1555 %<all,x2,t2c,t2a,ot2>\DeclareUnicodeCharacter{045F}{\cyrdzhe}
1556 %<all,x2,ot2>\DeclareUnicodeCharacter{0462}{\CYRYAT}
1557 %<all,x2,ot2>\DeclareUnicodeCharacter{0463}{\cyryat}
1558 %<all,x2>\DeclareUnicodeCharacter{046A}{\CYRBYUS}
1559 %<all,x2>\DeclareUnicodeCharacter{046B}{\cyrbyus}
1560 % \end{macrocode}
1561 % The next two declarations are questionable, the encoding definition
1562 % should probably contain |\CYROTLD| and |\cyrotld|. Or alternatively, if
1563 % the characters in the X2 encodings are really meant to represent the
1564 % historical characters in Ux0472 and Ux0473 (they look like them) then
1565 % they would need to change instead.
1566 %
1567 % However, their looks are probably a font designers decision and the next
1568 % two mappings are wrong or rather the names in OT2 should change for
1569 % consistency.
1570 %
1571 % On the other hand the names |\CYROTLD| are somewhat questionable as the
1572 % Unicode standard only describes ``Cyrillic barred O'' while |TLD| refers
1573 % to a tilde (which is more less what the ``Cyrillic FITA looks according
1574 % to the Unicode book).
1575 % \begin{macrocode}
1576 %<all,ot2>\DeclareUnicodeCharacter{0472}{\CYRFITA}
1577 %<all,ot2>\DeclareUnicodeCharacter{0473}{\cyrfita}
1578 % \end{macrocode}
1579 %
1580 % \begin{macrocode}
1581 %<all,x2,ot2>\DeclareUnicodeCharacter{0474}{\CYRIZH}
1582 %<all,x2,ot2>\DeclareUnicodeCharacter{0475}{\cyrizh}
1583 % \end{macrocode}
1584 % While the double grave accent seems to exist in X2, T2A, T2B and T2C
1585 % encoding, the letter izhitsa exists only in X2 and OT2. Therefore,
1586 % izhitsa with double grave seems to be possible only using X2.
1587 % \begin{macrocode}
1588 %<all,x2>\DeclareUnicodeCharacter{0476}{\C\CYRIZH}
1589 %<all,x2>\DeclareUnicodeCharacter{0477}{\C\cyrizh}
1590 % \end{macrocode}
1591 %
1592 % \begin{macrocode}
1593 %<all,t2c>\DeclareUnicodeCharacter{048C}{\CYRSEMISFTSN}
1594 %<all,t2c>\DeclareUnicodeCharacter{048D}{\cyrsemisftsn}
1595 %<all,t2c>\DeclareUnicodeCharacter{048E}{\CYRRTICK}
1596 %<all,t2c>\DeclareUnicodeCharacter{048F}{\cyrrtick}
1597 %<all,x2,t2a,lcy>\DeclareUnicodeCharacter{0490}{\CYRGUP}
1598 %<all,x2,t2a,lcy>\DeclareUnicodeCharacter{0491}{\cyrgup}
1599 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{0492}{\CYRGHCRS}
1600 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{0493}{\cyrghcrs}
1601 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{0494}{\CYRGHK}
1602 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{0495}{\cyrghk}
1603 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{0496}{\CYRZHDSC}
1604 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{0497}{\cyrzhdsc}
1605 %<all,x2,t2a>\DeclareUnicodeCharacter{0498}{\CYRZDSC}
1606 %<all,x2,t2a>\DeclareUnicodeCharacter{0499}{\cyrzdsc}
1607 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{049A}{\CYRKDSC}
1608 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{049B}{\cyrkdsc}
1609 %<all,x2,t2a>\DeclareUnicodeCharacter{049C}{\CYRKVCRS}
1610 %<all,x2,t2a>\DeclareUnicodeCharacter{049D}{\cyrkvcrs}
1611 %<all,x2,t2c>\DeclareUnicodeCharacter{049E}{\CYRKHCRS}
1612 %<all,x2,t2c>\DeclareUnicodeCharacter{049F}{\cyrkhcrs}
1613 %<all,x2,t2a>\DeclareUnicodeCharacter{04A0}{\CYRKBEAK}
1614 %<all,x2,t2a>\DeclareUnicodeCharacter{04A1}{\cyrkbeak}
1615 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04A2}{\CYRNDSC}
1616 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04A3}{\cyrndsc}
1617 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{04A4}{\CYRNG}
1618 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{04A5}{\cyrng}
1619 %<all,x2,t2c>\DeclareUnicodeCharacter{04A6}{\CYRPHK}
1620 %<all,x2,t2c>\DeclareUnicodeCharacter{04A7}{\cyrphk}
1621 %<all,x2,t2c>\DeclareUnicodeCharacter{04A8}{\CYRABHHA}
1622 %<all,x2,t2c>\DeclareUnicodeCharacter{04A9}{\cyrabhha}
1623 %<all,x2,t2a>\DeclareUnicodeCharacter{04AA}{\CYRSDSC}
1624 %<all,x2,t2a>\DeclareUnicodeCharacter{04AB}{\cyrsdsc}
1625 %<all,x2,t2c>\DeclareUnicodeCharacter{04AC}{\CYRTDSC}
1626 %<all,x2,t2c>\DeclareUnicodeCharacter{04AD}{\cyrtdsc}
1627 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{04AE}{\CYRY}
1628 %<all,x2,t2b,t2a>\DeclareUnicodeCharacter{04AF}{\cyry}
1629 %<all,x2,t2a>\DeclareUnicodeCharacter{04B0}{\CYRYHCRS}
1630 %<all,x2,t2a>\DeclareUnicodeCharacter{04B1}{\cyryhcrs}
1631 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04B2}{\CYRHDSC}
1632 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04B3}{\cyrhdsc}
1633 %<all,x2,t2c>\DeclareUnicodeCharacter{04B4}{\CYRTETSE}
1634 %<all,x2,t2c>\DeclareUnicodeCharacter{04B5}{\cyrtetse}
1635 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04B6}{\CYRCHRDSC}
1636 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04B7}{\cyrchrdsc}
1637 %<all,x2,t2a>\DeclareUnicodeCharacter{04B8}{\CYRCHVCRS}
1638 %<all,x2,t2a>\DeclareUnicodeCharacter{04B9}{\cyrchvcrs}
1639 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04BA}{\CYRSHHA}
1640 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04BB}{\cyrshha}
1641 %<all,x2,t2c>\DeclareUnicodeCharacter{04BC}{\CYRABHCH}
1642 %<all,x2,t2c>\DeclareUnicodeCharacter{04BD}{\cyrabhch}
1643 %<all,x2,t2c>\DeclareUnicodeCharacter{04BE}{\CYRABHCHDSC}
1644 %<all,x2,t2c>\DeclareUnicodeCharacter{04BF}{\cyrabhchdsc}
1645 % \end{macrocode}
1646 % The character |\CYRpalochka| is not defined by OT2 and LCY. However it is
1647 % looking identical to |\CYRII| and the Unicode standard explicitly refers
1648 % to that (and to Latin I). So perhaps those encodings could get an alias?
1649 % On the other hand, why are there two distinct slots in the T2 encodings
1650 % even though they are so pressed for space? Perhaps they don't always look
1651 % alike.
1652 % \begin{macrocode}
1653 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04C0}{\CYRpalochka}
1654 % \end{macrocode}
1655 %
1656 % \begin{macrocode}
1657 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04C1}{\U\CYRZH}
1658 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04C2}{\U\cyrzh}
1659 %<all,x2,t2b>\DeclareUnicodeCharacter{04C3}{\CYRKHK}
1660 %<all,x2,t2b>\DeclareUnicodeCharacter{04C4}{\cyrkhk}
1661 % \end{macrocode}
1662 % According to the Unicode standard Ux04C5 should be an L with ``tail'' not
1663 % with descender (which also exists as Ux04A2) but it looks as if the char
1664 % names do not make this distinction. Should they?
1665 % \begin{macrocode}
1666 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04C5}{\CYRLDSC}
1667 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04C6}{\cyrldsc}
1668 % \end{macrocode}
1669 %
1670 % \begin{macrocode}
1671 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04C7}{\CYRNHK}
1672 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04C8}{\cyrnhk}
1673 %<all,x2,t2b>\DeclareUnicodeCharacter{04CB}{\CYRCHLDSC}
1674 %<all,x2,t2b>\DeclareUnicodeCharacter{04CC}{\cyrchldsc}
1675 % \end{macrocode}
1676 % According to the Unicode standard Ux04CD should be an M with ``tail'' not
1677 % with descender. However this time there is no M with descender in the
1678 % Unicode standard.
1679 % \begin{macrocode}
1680 %<all,x2,t2c>\DeclareUnicodeCharacter{04CD}{\CYRMDSC}
1681 %<all,x2,t2c>\DeclareUnicodeCharacter{04CE}{\cyrmdsc}
1682 % \end{macrocode}
1683 %
1684 % \begin{macrocode}
1685 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D0}{\U\CYRA}
1686 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D1}{\U\cyra}
1687 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D2}{\"\CYRA}
1688 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D3}{\"\cyra}
1689 %<all,x2,t2a>\DeclareUnicodeCharacter{04D4}{\CYRAE}
1690 %<all,x2,t2a>\DeclareUnicodeCharacter{04D5}{\cyrae}
1691 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D6}{\U\CYRE}
1692 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04D7}{\U\cyre}
1693 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04D8}{\CYRSCHWA}
1694 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04D9}{\cyrschwa}
1695 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04DA}{\"\CYRSCHWA}
1696 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04DB}{\"\cyrschwa}
1697 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04DC}{\"\CYRZH}
1698 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04DD}{\"\cyrzh}
1699 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04DE}{\"\CYRZ}
1700 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04DF}{\"\cyrz}
1701 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04E0}{\CYRABHDZE}
1702 %<all,x2,t2c,t2b>\DeclareUnicodeCharacter{04E1}{\cyrabhdze}
1703 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E2}{\@tabacckludge=\CYRI}
1704 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E3}{\@tabacckludge=\cyri}
1705 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E4}{\"\CYRI}
1706 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E5}{\"\cyri}
1707 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E6}{\"\CYRO}
1708 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04E7}{\"\cyro}
1709 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04E8}{\CYROTLD}
1710 %<all,x2,t2c,t2b,t2a>\DeclareUnicodeCharacter{04E9}{\cyrotld}
1711 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04EC}{\"\CYREREV}
1712 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04ED}{\"\cyrerev}
1713 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04EE}{\@tabacckludge=\CYRU}
1714 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04EF}{\@tabacckludge=\cyru}
1715 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F0}{\"\CYRU}
1716 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F1}{\"\cyru}
1717 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F2}{\H\CYRU}
1718 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F3}{\H\cyru}
1719 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F4}{\"\CYRCH}
1720 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F5}{\"\cyrch}
1721 %<all,x2,t2b>\DeclareUnicodeCharacter{04F6}{\CYRGDSC}
1722 %<all,x2,t2b>\DeclareUnicodeCharacter{04F7}{\cyrgdsc}
1723 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F8}{\"\CYRERY}
1724 %<all,x2,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{04F9}{\"\cyrery}
1725 %<all,t2b>\DeclareUnicodeCharacter{04FA}{\CYRGDSCHCRS}
1726 %<all,t2b>\DeclareUnicodeCharacter{04FB}{\cyrgdschcrs}
1727 %<all,x2,t2b>\DeclareUnicodeCharacter{04FC}{\CYRHHK}
1728 %<all,x2,t2b>\DeclareUnicodeCharacter{04FD}{\cyrhhk}
1729 %<all,t2b>\DeclareUnicodeCharacter{04FE}{\CYRHHCRS}
1730 %<all,t2b>\DeclareUnicodeCharacter{04FF}{\cyrhhcrs}
1731 %<all,ts1>\DeclareUnicodeCharacter{0E3F}{\textbaht}
1732 %<all,t1>\DeclareUnicodeCharacter{1E02}{\.B}
1733 %<all,t1>\DeclareUnicodeCharacter{1E03}{\.b}
1734 % \end{macrocode}
1735 % \changes{v1.2k}{2021/01/27}{Added various additional dot accents (gh/484)}
1736 % \changes{v1.2n}{2021/06/21}{more extended latin entries for gh/593}
1737 % \begin{macrocode}
1738 %<all,t1>\DeclareUnicodeCharacter{1E0D}{\d d}
1739 %<all,t1>\DeclareUnicodeCharacter{1E1E}{\.F}
1740 %<all,t1>\DeclareUnicodeCharacter{1E1F}{\.f}
1741 %<all,t1>\DeclareUnicodeCharacter{1E25}{\d h}
1742 %<all,t1>\DeclareUnicodeCharacter{1E30}{\@tabacckludge'K}
1743 %<all,t1>\DeclareUnicodeCharacter{1E31}{\@tabacckludge'k}
1744 %<all,t1>\DeclareUnicodeCharacter{1E37}{\d l}
1745 %<all,t1>\DeclareUnicodeCharacter{1E8E}{\.Y}
1746 %<all,t1>\DeclareUnicodeCharacter{1E8F}{\.y}
1747 %<all,t1>\DeclareUnicodeCharacter{1E43}{\d m}
1748 %<all,t1>\DeclareUnicodeCharacter{1E45}{\.n}
1749 %<all,t1>\DeclareUnicodeCharacter{1E47}{\d n}
1750 %<all,t1>\DeclareUnicodeCharacter{1E5B}{\d r}
1751 %<all,t1>\DeclareUnicodeCharacter{1E63}{\d s}
1752 %<all,t1>\DeclareUnicodeCharacter{1E6D}{\d t}
1753 %<all,t1>\DeclareUnicodeCharacter{1E90}{\^Z}
1754 %<all,t1>\DeclareUnicodeCharacter{1E91}{\^z}
1755 %<all,t1>\DeclareUnicodeCharacter{1E9E}{\SS}
1756 %<all,t1>\DeclareUnicodeCharacter{1EF2}{\@tabacckludge`Y}
1757 %<all,t1>\DeclareUnicodeCharacter{1EF3}{\@tabacckludge`y}
1758 % \end{macrocode}
1759 %
1760 % \begin{macrocode}
1761 %<all,x2,t2c,t2b,t2a,t1,utf8>\DeclareUnicodeCharacter{200C}{\textcompwordmark}
1762 % \end{macrocode}
1763 % \changes{v1.1s}{2016/02/28}{Add more hyphens and dashes}
1764 % \begin{macrocode}
1765 %<all,t1>\DeclareUnicodeCharacter{2010}{-}
1766 %<all,t1>\DeclareUnicodeCharacter{2011}{\mbox{-}}
1767 % \end{macrocode}
1768 % U+2012 should be the width of a digit, endash is OK in many fonts including cm.
1769 % \begin{macrocode}
1770 %<all,t1>\DeclareUnicodeCharacter{2012}{\textendash}
1771 %<*all,x2,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>
1772 \DeclareUnicodeCharacter{2013}{\textendash}
1773 \DeclareUnicodeCharacter{2014}{\textemdash}
1774 % \end{macrocode}
1775 % U+2015 is Horizontal bar
1776 % \begin{macrocode}
1777 %<all,t1>\DeclareUnicodeCharacter{2015}{\textemdash}
1778 %</all,x2,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>
1779 %<all,ts1>\DeclareUnicodeCharacter{2016}{\textbardbl}
1780 %<*all,x2,t2c,t2b,t2a,t1,ot2,ot1,lcy>
1781 \DeclareUnicodeCharacter{2018}{\textquoteleft}
1782 \DeclareUnicodeCharacter{2019}{\textquoteright}
1783 %</all,x2,t2c,t2b,t2a,t1,ot2,ot1,lcy>
1784 %<all,t1>\DeclareUnicodeCharacter{201A}{\quotesinglbase}
1785 %<*all,x2,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>
1786 \DeclareUnicodeCharacter{201C}{\textquotedblleft}
1787 \DeclareUnicodeCharacter{201D}{\textquotedblright}
1788 %</all,x2,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>
1789 %<all,x2,t2c,t2b,t2a,t1,lcy>\DeclareUnicodeCharacter{201E}{\quotedblbase}
1790 %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{2020}{\textdagger}
1791 %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{2021}{\textdaggerdbl}
1792 %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{2022}{\textbullet}
1793 %<all,ly1,utf8>\DeclareUnicodeCharacter{2026}{\textellipsis}
1794 %<*all,x2,ts1,t2c,t2b,t2a,t1,ly1>
1795 \DeclareUnicodeCharacter{2030}{\textperthousand}
1796 %</all,x2,ts1,t2c,t2b,t2a,t1,ly1>
1797 %<*all,x2,ts1,t2c,t2b,t2a,t1>
1798 \DeclareUnicodeCharacter{2031}{\textpertenthousand}
1799 %</all,x2,ts1,t2c,t2b,t2a,t1>
1800 %<all,t1,ly1>\DeclareUnicodeCharacter{2039}{\guilsinglleft}
1801 %<all,t1,ly1>\DeclareUnicodeCharacter{203A}{\guilsinglright}
1802 %<all,ts1>\DeclareUnicodeCharacter{203B}{\textreferencemark}
1803 %<all,ts1>\DeclareUnicodeCharacter{203D}{\textinterrobang}
1804 %<all,ts1>\DeclareUnicodeCharacter{2044}{\textfractionsolidus}
1805 %<all,ts1>\DeclareUnicodeCharacter{204E}{\textasteriskcentered}
1806 %<all,ts1>\DeclareUnicodeCharacter{2052}{\textdiscount}
1807 %<all,ts1>\DeclareUnicodeCharacter{20A1}{\textcolonmonetary}
1808 %<all,ts1>\DeclareUnicodeCharacter{20A4}{\textlira}
1809 %<all,ts1>\DeclareUnicodeCharacter{20A6}{\textnaira}
1810 %<all,ts1>\DeclareUnicodeCharacter{20A9}{\textwon}
1811 %<all,ts1>\DeclareUnicodeCharacter{20AB}{\textdong}
1812 %<all,ts1>\DeclareUnicodeCharacter{20AC}{\texteuro}
1813 %<all,ts1>\DeclareUnicodeCharacter{20B1}{\textpeso}
1814 %<all,ts1>\DeclareUnicodeCharacter{2103}{\textcelsius}
1815 %<all,x2,ts1,t2c,t2b,t2a,ot2,lcy>\DeclareUnicodeCharacter{2116}{\textnumero}
1816 %<all,ts1>\DeclareUnicodeCharacter{2117}{\textcircledP}
1817 %<all,ts1>\DeclareUnicodeCharacter{211E}{\textrecipe}
1818 %<all,ts1>\DeclareUnicodeCharacter{2120}{\textservicemark}
1819 %<all,ts1,ly1,utf8>\DeclareUnicodeCharacter{2122}{\texttrademark}
1820 %<all,ts1>\DeclareUnicodeCharacter{2126}{\textohm}
1821 %<all,ts1>\DeclareUnicodeCharacter{2127}{\textmho}
1822 %<all,ts1>\DeclareUnicodeCharacter{212E}{\textestimated}
1823 %<all,ts1>\DeclareUnicodeCharacter{2190}{\textleftarrow}
1824 %<all,ts1>\DeclareUnicodeCharacter{2191}{\textuparrow}
1825 %<all,ts1>\DeclareUnicodeCharacter{2192}{\textrightarrow}
1826 %<all,ts1>\DeclareUnicodeCharacter{2193}{\textdownarrow}
1827 % \end{macrocode}
1828 % \changes{v1.3b}{2022/05/08}{Declare Unicode codepoints U+3008/U+3009 to
1829 % better support normalized documents}
1830 % \begin{macrocode}
1831 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{2329}{\textlangle}
1832 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{3008}{\textlangle}
1833 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{232A}{\textrangle}
1834 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{3009}{\textrangle}
1835 %<all,ts1>\DeclareUnicodeCharacter{2422}{\textblank}
1836 %<all,x2,t2c,t2b,t2a,t1,utf8>\DeclareUnicodeCharacter{2423}{\textvisiblespace}
1837 %<all,ts1>\DeclareUnicodeCharacter{25E6}{\textopenbullet}
1838 %<all,ts1>\DeclareUnicodeCharacter{25EF}{\textbigcircle}
1839 %<all,ts1>\DeclareUnicodeCharacter{266A}{\textmusicalnote}
1840 % \end{macrocode}
1841 % \changes{v1.2h}{2019/02/07}{Added 27E8 and 27E9 (github/110)}
1842 % \begin{macrocode}
1843 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{27E8}{\textlangle}
1844 %<all,x2,ts1,t2c,t2b,t2a>\DeclareUnicodeCharacter{27E9}{\textrangle}
1845 %<all,t1>\DeclareUnicodeCharacter{1E20}{\@tabacckludge=G}
1846 %<all,t1>\DeclareUnicodeCharacter{1E21}{\@tabacckludge=g}
1847 % \end{macrocode}
1848 %
1849 % When doing cut-and-paste from other documents f-ligatures might show
1850 % up as Unicode characters. We translate them back to individual
1851 % characters so that they get accepted. If supported by the font
1852 % (which is normally the case) they are then reconstructed as
1853 % ligatures so they come out as desired. Otherwise they will come
1854 % out as individual characters which is fine too.
1855 % \changes{v1.2j}{2019/07/11}{Add typical f-ligatures and s-ligatures and st (github/154)}
1856 % \changes{v1.kj}{2019/11/14}{Fixed setting for FB05 = long-s t lig (github/154)}
1857 % \begin{macrocode}
1858 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB00}{ff} % ff
1859 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB01}{fi} % fi
1860 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB02}{fl} % fl
1861 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB03}{ffi} % ffi
1862 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB04}{ffl} % ffl
1863 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB05}{st} % ſt -- this is the long s (not f)
1864 %<all,t1,ot1,ly1,t2a,t2b,t2c>\DeclareUnicodeCharacter{FB06}{st} % st
1865 % \end{macrocode}
1866 %
1867 %
1868 % \changes{v1.2c}{2018/04/05}{Add BOM}
1869 % \begin{macrocode}
1870 %<all,ts1,utf8>\DeclareUnicodeCharacter{FEFF}{\ifhmode\nobreak\fi}
1871 % \end{macrocode}
1872 %
1873 %
1874 % \endgroup
1875 % \subsection{Notes}
1876 %
1877 % \changes{v1.1e}{2004/05/22}{Added notes on inconsistency with `8-bit files'.}
1878 % The following inputs are inconsistent with the 8-bit inputenc files
1879 % since they will always only produce the `text character'. This is an
1880 % area where inputenc is notoriously confused.
1881 % \begin{verbatim}
1882 % %<all,ts1,t1,ot1,ly1>\DeclareUnicodeCharacter{00A3}{\textsterling}
1883 % %<*all,x2,ts1,t2c,t2b,t2a,oms,ly1>
1884 % \DeclareUnicodeCharacter{00A7}{\textsection}
1885 % %</all,x2,ts1,t2c,t2b,t2a,oms,ly1>
1886 % %<all,ts1,utf8>\DeclareUnicodeCharacter{00A9}{\textcopyright}
1887 % %<all,ts1>\DeclareUnicodeCharacter{00B1}{\textpm}
1888 % %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{00B6}{\textparagraph}
1889 % %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{2020}{\textdagger}
1890 % %<all,ts1,oms,ly1>\DeclareUnicodeCharacter{2021}{\textdaggerdbl}
1891 % %<all,ly1,utf8>\DeclareUnicodeCharacter{2026}{\textellipsis}
1892 % \end{verbatim}
1893 %
1894 % The following definitions are in an encoding file but have no
1895 % direct equivalent in Unicode, or they simply do not make sense in that
1896 % context (or we have not yet found anything or \ldots :-). For
1897 % example, the non-combining accent characters are certainly
1898 % available somewhere but these are not equivalent to a \TeX{}
1899 % accent command.
1900 %\begin{verbatim}
1901 %\DeclareTextSymbol{\j}{OT1}{17}
1902 %\DeclareTextSymbol{\SS}{T1}{223}
1903 %\DeclareTextSymbol{\textcompwordmark}{T1}{23}
1904 %
1905 %\DeclareTextAccent{\"}{OT1}{127}
1906 %\DeclareTextAccent{\'}{OT1}{19}
1907 %\DeclareTextAccent{\.}{OT1}{95}
1908 %\DeclareTextAccent{\=}{OT1}{22}
1909 %\DeclareTextAccent{\H}{OT1}{125}
1910 %\DeclareTextAccent{\^}{OT1}{94}
1911 %\DeclareTextAccent{\`}{OT1}{18}
1912 %\DeclareTextAccent{\r}{OT1}{23}
1913 %\DeclareTextAccent{\u}{OT1}{21}
1914 %\DeclareTextAccent{\v}{OT1}{20}
1915 %\DeclareTextAccent{\~}{OT1}{126}
1916 %\DeclareTextCommand{\b}{OT1}[1]
1917 %\DeclareTextCommand{\c}{OT1}[1]
1918 %\DeclareTextCommand{\d}{OT1}[1]
1919 %\DeclareTextCommand{\k}{T1}[1]
1920 %\end{verbatim}
1921 %
1922 %
1923 %
1924 % \subsection{Mappings for OT1 glyphs}
1925 %
1926 % This is even more incomplete as again it covers only the single
1927 % glyphs from |OT1| plus some that have been explicitly defined for
1928 % this encoding. Everything that is provided in |T1|, and that
1929 % could be provided as composite glyphs via |OT1|, could and
1930 % probably should be set up as well. Which leaves the many things
1931 % that are not provided in |T1| but can be provided in |OT1| (and
1932 % in |T1|) by composite glyphs.
1933 %
1934 % Stuff not mapped (note that |\j| ($\jmath$) is not equivalent to any
1935 % Unicode character):
1936 %\begin{verbatim}
1937 %\DeclareTextSymbol{\j}{OT1}{17}
1938 %\DeclareTextAccent{\"}{OT1}{127}
1939 %\DeclareTextAccent{\'}{OT1}{19}
1940 %\DeclareTextAccent{\.}{OT1}{95}
1941 %\DeclareTextAccent{\=}{OT1}{22}
1942 %\DeclareTextAccent{\^}{OT1}{94}
1943 %\DeclareTextAccent{\`}{OT1}{18}
1944 %\DeclareTextAccent{\~}{OT1}{126}
1945 %\DeclareTextAccent{\H}{OT1}{125}
1946 %\DeclareTextAccent{\u}{OT1}{21}
1947 %\DeclareTextAccent{\v}{OT1}{20}
1948 %\DeclareTextAccent{\r}{OT1}{23}
1949 %\DeclareTextCommand{\b}{OT1}[1]
1950 %\DeclareTextCommand{\c}{OT1}[1]
1951 %\DeclareTextCommand{\d}{OT1}[1]
1952 %\end{verbatim}
1953 %
1954 %
1955 %
1956 % \subsection{Mappings for OMS glyphs}
1957 %
1958 % Characters like |\textbackslash| are not mapped as they are
1959 % (primarily) only in the lower 127 and the code here only sets up
1960 % mappings for UTF-8 characters that are at least 2 octets long.
1961 %\begin{verbatim}
1962 %\DeclareTextSymbol{\textbackslash}{OMS}{110} % "6E
1963 %\DeclareTextSymbol{\textbar}{OMS}{106} % "6A
1964 %\DeclareTextSymbol{\textbraceleft}{OMS}{102} % "66
1965 %\DeclareTextSymbol{\textbraceright}{OMS}{103} % "67
1966 %\end{verbatim}
1967 %
1968 % But the following (and some others) might actually lurk in Unicode
1969 % somewhere\ldots
1970 %\begin{verbatim}
1971 %\DeclareTextSymbol{\textasteriskcentered}{OMS}{3} % "03
1972 %\DeclareTextCommand{\textcircled}{OMS}
1973 %\end{verbatim}
1974 %
1975 %
1976 %
1977 %
1978 % \subsection{Mappings for TS1 glyphs}
1979 %
1980 % Exercise for somebody else.
1981 %
1982 %
1983 % \subsection{Mappings for \texttt{latex.ltx} glyphs}
1984 %
1985 % There is also a collection of characters already set up in the kernel,
1986 % one way or the other. Since these do not clearly relate to any
1987 % particular font encoding they are mapped when the
1988 % \texttt{utf8} support is first set up.
1989 %
1990 % Also there are a number of |\providecommand|s in the various input
1991 % encoding files which may or may not go into this part.
1992 % \changes{v1.1b}{2004/02/09}{Added commands already defined in the kernel}
1993 % \begin{macrocode}
1994 %<*utf8>
1995 % This space is intentionally empty ...
1996 %</utf8>
1997 % \end{macrocode}
1998 %
1999 % \subsection{Old \texttt{utf8.def} file as a temp fix for p\TeX{} and friends}
2000 %
2001 %
2002 % \changes{v1.2h}{2019/07/09}{Temp rollback fix for e-pTeX}
2003 % \begin{macrocode}
2004 %<*utf8-2018>
2005 \ProvidesFile{utf8.def}
2006 [2018/10/05 v1.2f UTF-8 support for inputenc]
2007 \makeatletter
2008 \catcode`\ \saved@space@catcode
2009 \long\def\UTFviii@two@octets#1#2{\expandafter
2010 \UTFviii@defined\csname u8:#1\string#2\endcsname}
2011 \long\def\UTFviii@three@octets#1#2#3{\expandafter
2012 \UTFviii@defined\csname u8:#1\string#2\string#3\endcsname}
2013 \long\def\UTFviii@four@octets#1#2#3#4{\expandafter
2014 \UTFviii@defined\csname u8:#1\string#2\string#3\string#4\endcsname}
2015 \def\UTFviii@defined#1{%
2016 \ifx#1\relax
2017 \if\relax\expandafter\UTFviii@checkseq\string#1\relax\relax
2018 \UTFviii@undefined@err{#1}%
2019 \else
2020 \PackageError{inputenc}{Invalid UTF-8 byte sequence}%
2021 \UTFviii@invalid@help
2022 \fi
2023 \else\expandafter
2024 #1%
2025 \fi
2026 }
2027 \def\UTFviii@invalid@err#1{%
2028 \PackageError{inputenc}{Invalid UTF-8 byte "\UTFviii@hexnumber{`#1}}%
2029 \UTFviii@invalid@help}
2030 \def\UTFviii@invalid@help{%
2031 The document does not appear to be in UTF-8 encoding.\MessageBreak
2032 Try adding \noexpand\UseRawInputEncoding as the first line of the file\MessageBreak
2033 or specify an encoding such as \noexpand\usepackage[latin1]{inputenc}\MessageBreak
2034 in the document preamble.\MessageBreak
2035 Alternatively, save the file in UTF-8 using your editor or another tool}
2036 \def\UTFviii@undefined@err#1{%
2037 \PackageError{inputenc}{Unicode character \expandafter
2038 \UTFviii@splitcsname\string#1\relax
2039 \MessageBreak
2040 not set up for use with LaTeX}%
2041 {You may provide a definition with\MessageBreak
2042 \noexpand\DeclareUnicodeCharacter}%
2043 }
2044 \def\UTFviii@checkseq#1:#2#3{%
2045 \ifnum`#2<"80 %
2046 \ifx\relax#3\else1\fi
2047 \else
2048 \ifnum`#2<"C0 %
2049 1 %
2050 \else
2051 \expandafter\expandafter\expandafter\UTFviii@check@continue
2052 \expandafter\expandafter\expandafter#3%
2053 \fi
2054 \fi}
2055 \def\UTFviii@check@continue#1{%
2056 \ifx\relax#1%
2057 \else
2058 \ifnum`#1<"80 1\else\ifnum`#1>"BF 1\fi\fi
2059 \expandafter\UTFviii@check@continue
2060 \fi
2061 }
2062 \begingroup
2063 \catcode`\~13
2064 \catcode`\"12
2065 \def\UTFviii@loop{%
2066 \uccode`\~\count@
2067 \uppercase\expandafter{\UTFviii@tmp}%
2068 \advance\count@\@ne
2069 \ifnum\count@<\@tempcnta
2070 \expandafter\UTFviii@loop
2071 \fi}
2072 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@undefined@err{:\string~}}}
2073 \count@"1
2074 \@tempcnta9
2075 \UTFviii@loop
2076 \count@11
2077 \@tempcnta12
2078 \UTFviii@loop
2079 \count@14
2080 \@tempcnta32
2081 \UTFviii@loop
2082 \count@"80
2083 \@tempcnta"C2
2084 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@invalid@err\string~}}
2085 \UTFviii@loop
2086 \count@"C2
2087 \@tempcnta"E0
2088 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@two@octets\string~}}
2089 \UTFviii@loop
2090 \count@"E0
2091 \@tempcnta"F0
2092 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@three@octets\string~}}
2093 \UTFviii@loop
2094 \count@"F0
2095 \@tempcnta"F5
2096 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@four@octets\string~}}
2097 \UTFviii@loop
2098 \count@"F5
2099 \@tempcnta"100
2100 \def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@invalid@err\string~}}
2101 \UTFviii@loop
2102 \endgroup
2103 \@inpenc@test
2104 \ifx\@begindocumenthook\@undefined
2105 \makeatother
2106 \endinput \fi
2107 \begingroup
2108 \catcode`\"=12
2109 \catcode`\<=12
2110 \catcode`\.=12
2111 \catcode`\,=12
2112 \catcode`\;=12
2113 \catcode`\!=12
2114 \catcode`\~=13
2115 \gdef\DeclareUnicodeCharacter#1#2{%
2116 \count@"#1\relax
2117 \wlog{ \space\space defining Unicode char U+#1 (decimal \the\count@)}%
2118 \begingroup
2119 \parse@XML@charref
2120 \def\UTFviii@two@octets##1##2{\csname u8:##1\string##2\endcsname}%
2121 \def\UTFviii@three@octets##1##2##3{\csname u8:##1%
2122 \string##2\string##3\endcsname}%
2123 \def\UTFviii@four@octets##1##2##3##4{\csname u8:##1%
2124 \string##2\string##3\string##4\endcsname}%
2125 \expandafter\expandafter\expandafter
2126 \expandafter\expandafter\expandafter
2127 \expandafter
2128 \gdef\UTFviii@tmp{\IeC{#2}}%
2129 \endgroup
2130 }
2131 \gdef\parse@XML@charref{%
2132 \ifnum\count@<"A0\relax
2133 \ifnum\catcode\count@=13
2134 \uccode`\~=\count@\uppercase{\def\UTFviii@tmp{\@empty\@empty~}}%
2135 \else
2136 \PackageError{inputenc}{Cannot define non-active Unicode char value < 00A0}%
2137 \@eha
2138 \def\UTFviii@tmp{\UTFviii@tmp}%
2139 \fi
2140 \else\ifnum\count@<"800\relax
2141 \parse@UTFviii@a,%
2142 \parse@UTFviii@b C\UTFviii@two@octets.,%
2143 \else\ifnum\count@<"10000\relax
2144 \parse@UTFviii@a;%
2145 \parse@UTFviii@a,%
2146 \parse@UTFviii@b E\UTFviii@three@octets.{,;}%
2147 \else
2148 \ifnum\count@>"10FFFF\relax
2149 \PackageError{inputenc}%
2150 {\UTFviii@hexnumber\count@\space too large for Unicode}%
2151 {Values between 0 and 10FFFF are permitted}%
2152 \fi
2153 \parse@UTFviii@a;%
2154 \parse@UTFviii@a,%
2155 \parse@UTFviii@a!%
2156 \parse@UTFviii@b F\UTFviii@four@octets.{!,;}%
2157 \fi
2158 \fi
2159 \fi
2160 }
2161 \gdef\parse@UTFviii@a#1{%
2162 \@tempcnta\count@
2163 \divide\count@ 64
2164 \@tempcntb\count@
2165 \multiply\count@ 64
2166 \advance\@tempcnta-\count@
2167 \advance\@tempcnta 128
2168 \uccode`#1\@tempcnta
2169 \count@\@tempcntb}
2170 \gdef\parse@UTFviii@b#1#2#3#4{%
2171 \advance\count@ "#10\relax
2172 \uccode`#3\count@
2173 \uppercase{\gdef\UTFviii@tmp{#2#3#4}}}
2174 \ifx\numexpr\@undefined
2175 \gdef\decode@UTFviii#1{0}
2176 \else
2177 \gdef\decode@UTFviii#1\relax{%
2178 \expandafter\UTFviii@cleanup
2179 \the\numexpr\dec@de@UTFviii#1\relax)))))\@empty}
2180 \gdef\UTFviii@cleanup#1)#2\@empty{#1}
2181 \gdef\dec@de@UTFviii#1{%
2182 \ifx\relax#1%
2183 \else
2184 \ifnum`#1>"EF
2185 ((((`#1-"F0)%
2186 \else
2187 \ifnum`#1>"DF
2188 (((`#1-"E0)%
2189 \else
2190 \ifnum`#1>"BF
2191 ((`#1-"C0)%
2192 \else
2193 \ifnum`#1>"7F
2194 )*64+(`#1-"80)%
2195 \else
2196 +`#1 %
2197 \fi
2198 \fi
2199 \fi
2200 \fi
2201 \expandafter\dec@de@UTFviii
2202 \fi}
2203 \fi
2204 \ifx\numexpr\@undefined
2205 \global\let\UTFviii@hexnumber\@firstofone
2206 \global\UTFviii@hexdigit\hexnumber@
2207 \else
2208 \gdef\UTFviii@hexnumber#1{%
2209 \ifnum#1>15 %
2210 \expandafter\UTFviii@hexnumber\expandafter{\the\numexpr(#1-8)/16\relax}%
2211 \fi
2212 \UTFviii@hexdigit{\numexpr#1\ifnum#1>0-((#1-8)/16)*16\fi\relax}%
2213 }
2214 \gdef\UTFviii@hexdigit#1{\ifcase\numexpr#1\relax
2215 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or
2216 A\or B\or C\or D\or E\or F\fi}
2217 \fi
2218 \gdef\UTFviii@hexcodepoint#1{U+%
2219 \ifnum#1<16 0\fi
2220 \ifnum#1<256 0\fi
2221 \ifnum#1<4096 0\fi
2222 \UTFviii@hexnumber{#1}%
2223 }%
2224 \gdef\UTFviii@splitcsname#1:#2\relax{%
2225 #2 (\expandafter\UTFviii@hexcodepoint\expandafter{%
2226 \the\numexpr\decode@UTFviii#2\relax})%
2227 }
2228 \endgroup
2229 \@onlypreamble\DeclareUnicodeCharacter
2230 \@onlypreamble\parse@XML@charref
2231 \@onlypreamble\parse@UTFviii@a
2232 \@onlypreamble\parse@UTFviii@b
2233 \begingroup
2234 \def\cdp@elt#1#2#3#4{%
2235 \wlog{Now handling font encoding #1 ...}%
2236 \lowercase{%
2237 \InputIfFileExists{#1enc.dfu}}%
2238 {\wlog{... processing UTF-8 mapping file for font %
2239 encoding #1}%
2240 \catcode`\ 9\relax}%
2241 {\wlog{... no UTF-8 mapping file for font encoding #1}}%
2242 }
2243 \cdp@list
2244 \endgroup
2245 \def\DeclareFontEncoding@#1#2#3{%
2246 \expandafter
2247 \ifx\csname T@#1\endcsname\relax
2248 \def\cdp@elt{\noexpand\cdp@elt}%
2249 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
2250 {\default@family}{\default@series}%
2251 {\default@shape}}%
2252 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
2253 \begingroup
2254 \wlog{Now handling font encoding #1 ...}%
2255 \lowercase{%
2256 \InputIfFileExists{#1enc.dfu}}%
2257 {\wlog{... processing UTF-8 mapping file for font %
2258 encoding #1}}%
2259 {\wlog{... no UTF-8 mapping file for font encoding #1}}%
2260 \endgroup
2261 \else
2262 \@font@info{Redeclaring font encoding #1}%
2263 \fi
2264 \global\@namedef{T@#1}{#2}%
2265 \global\@namedef{M@#1}{\default@M#3}%
2266 \xdef\LastDeclaredEncoding{#1}%
2267 }
2268 \DeclareUnicodeCharacter{00A9}{\textcopyright}
2269 \DeclareUnicodeCharacter{00AA}{\textordfeminine}
2270 \DeclareUnicodeCharacter{00AE}{\textregistered}
2271 \DeclareUnicodeCharacter{00BA}{\textordmasculine}
2272 \DeclareUnicodeCharacter{02C6}{\textasciicircum}
2273 \DeclareUnicodeCharacter{02DC}{\textasciitilde}
2274 \DeclareUnicodeCharacter{200C}{\textcompwordmark}
2275 \DeclareUnicodeCharacter{2026}{\textellipsis}
2276 \DeclareUnicodeCharacter{2122}{\texttrademark}
2277 \DeclareUnicodeCharacter{2423}{\textvisiblespace}
2278 \DeclareUnicodeCharacter{FEFF}{\ifhmode\nobreak\fi}
2279 \endinput
2280 </utf8-2018>
2281 % \end{macrocode}
2282 %
2283 %
2284 % \section{A test document}
2285 %
2286 % Here is a very small test document which may or may not survive
2287 % if the current document is transferred from one place to the
2288 % other.
2289 % \begin{macrocode}
2290 %<*test>
2291 \documentclass{article}
2292
2293 \usepackage[latin1,utf8]{inputenc}
2294 \usepackage[T1]{fontenc}
2295 \usepackage{trace}
2296
2297 \scrollmode % to run past the error below
2298
2299 \begin{document}
2300
2301 German umlauts in UTF-8: ^^c3^^a4^^c3^^b6^^c3^^bc %%% äöü
2302
2303 \inputencoding{latin1} % switch to latin1
2304
2305 German umlauts in UTF-8 but read by latin1 (and will produce one
2306 error since \verb=\textcurrency= is not provided):
2307 ^^c3^^a4^^c3^^b6^^c3^^bc
2308
2309 \inputencoding{utf8} % switch back to utf8
2310
2311 German umlauts in UTF-8: ^^c3^^a4^^c3^^b6^^c3^^bc
2312
2313
2314 Some codes that should produce errors as nothing is set up
2315 for them: ^^c3F ^^e1^^a4^^b6
2316
2317 And some that are not legal utf8 sequences: ^^c3X ^^e1XY
2318
2319 \showoutput
2320 \tracingstats=2
2321 \stop
2322 %</test>
2323 % \end{macrocode}
2324 %
2325 % \Finale
2326 %
2327 \endinput