forked from latex3/latex2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputenc.dtx
3053 lines (3050 loc) · 104 KB
/
inputenc.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
% LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\usepackage[ascii]{inputenc}
\GetFileInfo{inputenc.sty}
\title{\filename}
\date{\fileversion\space\filedate}
\author{%
Alan Jeffrey\and
Frank Mittelbach}
\begin{document}
\MaintainedByLaTeXTeam{latex}
\maketitle
\setlength\hfuzz{20pt}
\DocInput{inputenc.dtx}
\end{document}
%</driver>
% \fi
%
%
%
% \changes{v0.01}{1994/03/09}{Created file.}
% \changes{v0.02}{1994/07/14}{Replaced \cs{Dh} by \cs{DH} and \cs{Th}
% by \cs{TH}.}
% \changes{v0.02}{1994/07/14}{Added \cs{ensuremath} to some math
% commands.}
% \changes{v0.02}{1994/07/14}{Added \cs{inputencoding}.}
% \changes{v0.03}{1994/09/04}{Added \cs{DeclareInputComposite} and the
% \cs{ProvidesCommand}s to the encoding files.}
% \changes{v0.03}{1994/09/04}{Removed the definition of the accent slots
% in Latin-1.}
% \changes{v0.04}{1994/10/20}{Replaced \cs{DeclareInputCharacter} by
% \cs{DeclareInputText} and \cs{DeclareInputMath}.}
% \changes{v0.04}{1994/10/20}{Removed \cs{DeclareInputComposite}.}
% \changes{v0.04}{1994/10/20}{Made many Latin-1 characters math-only.}
% \changes{v0.05}{1994/10/27}{Updated for the new version of ltoutenc.}
% \changes{v0.06}{1994/11/21}{Added \cs{textregistered}.}
% \changes{v0.06}{1994/11/21}{Added slot hex A0 to Latin-1.}
% \changes{v0.07}{1994/11/22}{Fixed typo A1 rather than A0.}
% \changes{v0.07}{1994/11/28}{Fixed where docstrip option had moved a
% line.}
% \changes{v0.09}{1994/12/10}{Added `beta test' message.}
% \changes{v0.09}{1994/12/10}{Made letters active and undefined by
% default, rather than illegal.}
%
% \changes{v0.9b}{1995/05/23}{Added Mac encoding, applemac.def}
% \changes{v0.9d}{1995/06/06}{Added cp437}
% \changes{v0.9f}{1995/09/21}{Added Next encoding, next.def}
% \changes{v0.9h}{1995/10/22}{Added Windows 3.1 ANSI encoding,
% ansinew.def}
% \changes{v0.9i}{1995/11/02}{Wrapped long lines}
% \changes{v0.9i}{1995/11/02}{Changed internal name \cs{a} to
% \cs{@tabacckludge} to protect against redefinition by malicious
% users.}
% \changes{v0.9j}{1995/11/14}{Remove \cs{endinput} so docstrip reaches
% ansinew encoding}
% \changes{v0.9k}{1995/11/29}{Replaced uses of \cs{textsterling} with
% \cs{pounds}.}
% \changes{v0.9m}{1995/12/04}{Added German version}
% \changes{v0.9m}{1995/12/04}{Replaced \cs{textasciitilde} by
% \cs{nobreakspace}.}
% \changes{v0.9m}{1995/12/04}{Made bullet and periodcentered text
% glyphs rather than math glyphs.}
% \changes{v0.9m}{1995/12/04}{Added \cs{@tabacckludge} hacks.}
% \changes{v0.9o}{1996/02/14}
% {Cedilla (\cs{c}\cs{ }) rather than (\cs{c}\{\}) latex/2077,
% finished on 1996/10/28}
% \changes{v0.9o}{1996/02/14}
% {0F0 corrected in cp850 latex/2080}
% \changes{v0.9o}{1996/02/14}
% {0B2 corrected in latin2 latex/2079}
% \changes{v0.9r}{1996/05/10}{Added cp852.def}
% \changes{v0.9t}{1996/10/28}{Added cp865.def}
% \changes{v0.9t}{1996/10/28}
% {Changed \cs{aa} and \cs{AA} to \cs{r} a and \cs{r} A}
% \changes{v0.9u}{1996/10/29}{Added more to cp865.def}
% \changes{v0.9y}{1997/04/30}{Added latin5.def (provided by
% H. Turgut Uyar: [email protected])}
% \changes{v0.9z}{1997/05/10}{Added latin3.def (provided by
% J\"org Knappen and modified by Chris Rowley)}
% \changes{v0.91}{1997/08/19}{Put
% \cs{makeatletter}\ldots\cs{makeatother} around all .def files.}
% \changes{v0.92}{1997/09/08}{Added decmulti.def
% provided by M.Y. Chartoire. pr/2599}
% \changes{v0.93}{1997/11/23}{\cs{textperthousand} not
% \cs{textpermill}. pr/2673}
% \changes{v0.94}{1997/12/17}{Made degree a text glyph}
% \changes{v0.94}{1997/12/17}{Added to and tidied documentation}
% \changes{v0.94}{1997/12/17}{Ogonek: changed
% \cs{k}\{\} to \cs{k}\cs{ }}
% \changes{v0.94}{1997/12/17}{NOTE: for consistency, when available
% the robust text-or-math internal form is always used --
% THIS MAY CHANGE}
% \changes{v0.95}{1997/12/20}{Updated documentation}
% \changes{v0.97}{1998/03/05}{Spanish ords changed to text chars, pr/2579}
% \changes{v1.1b}{2006/03/04}{Number of normalisations in the LICR
% representation (pr/3849)}
% \changes{v1.1c}{2006/11/18}{Added missing \cs{ProvidesFile} line for cp1257 (pr/3892)}
%
%
% \section{Introduction}
%
% This package allows the user to specify an input encoding (for
% example, ASCII, ISO Latin-1 or Macintosh) by saying:
% \begin{quote}
% |\usepackage[|\emph{encoding name}|]{inputenc}|
% \end{quote}
% The encoding can also be selected in the document with:
% \begin{quote}
% |\inputencoding{|\emph{encoding name}|}|
% \end{quote}
% Originally this command was only to be used in vertical mode (with
% the idea that it should be only within a document when
% using text from several documents to build up a composite work such
% as a volume of journal articles. However, usages in certain
% languages suggested that it might be preferable to allow changing
% the input encoding at any time, which is what is possible now
% (though that is quite computing resource intensive).
%
% The encodings provided by this package are:
% \begin{itemize}
% \item |ascii| ASCII encoding for the range 32--127 (all others are made
% invalid, i.e., this really defines a 7-bit encoding).
% \item |latin1| ISO Latin-1 encoding.
% \item |latin2| ISO Latin-2 encoding.
% \item |latin3| ISO Latin-3 encoding.
% \item |latin4| ISO Latin-4 encoding.
% \item |latin5| ISO Latin-5 encoding.
% \item |latin9| ISO Latin-9 encoding.
% \item |latin10| ISO Latin-10 encoding.
% \item |decmulti| DEC Multinational Character Set encoding.
% \item |cp850| IBM 850 code page.
% \item |cp852| IBM 852 code page.
% \item |cp858| IBM 858 code page (this is 850 with Euro symbol).
% \item |cp437| IBM 437 code page.
% \item |cp437de| IBM 437 code page (German version).
% \item |cp865| IBM 865 code page.
% \item |applemac| Macintosh encoding.
% \item |macce| Macintosh Central European code page.
% \item |next| Next encoding.
% \item |cp1250| Windows 1250 (central and eastern Europe) code page.
% \item |cp1252| Windows 1252 (Western Europe) code page.
% \item |cp1257| Windows 1257 (Baltic) code page.
% \item |ansinew| Windows 3.1 ANSI encoding, extension of Latin-1
% (synonym\footnote{It is now generated using the guards
% \texttt{cp1252,ansinew} the latter only used for the provides
% file line.} for |cp1252|).
% \item |utf8| Unicode UTF-8 encoding support.
% \end{itemize}
%
%
%
% \subsection{8-bit input encoding support}
%
% The \texttt{inputenc} package makes the upper 8-bit characters active and
% assigns to all of them an error message. It then waits for the
% input encoding definitions to change this set-up. Similarly, whenever
% |\inputencoding| is encountered in a document, first the upper
% 8-bit characters are set back to produce an error and then the
% definitions for the new input encoding are loaded, changing some of the
% previous settings.
%
%
%
% Each encoding has an associated |.def| file, for example
% |latin1.def| which defines the behaviour of each input character,
% using the commands:
% \begin{quote}
% |\DeclareInputText{|\emph{slot}|}{|\emph{text}|}| \\
% |\DeclareInputMath{|\emph{slot}|}{|\emph{math}|}|
% \end{quote}
% This defines the input character \emph{slot} to be the
% \emph{text} material or \emph{math} material respectively.
% For example, |latin1.def| defines slots |"D6| (\AE)
% and |"B5| ($\mu$) by saying:
%\begin{verbatim}
% \DeclareInputText{214}{\AE}
% \DeclareInputMath{181}{\mu}
%\end{verbatim}
% Note that the \emph{commands} should be robust, and should not be
% dependent on the output encoding. The same \emph{slot} should not
% have both a text and a math declaration for it. (This restriction
% may be removed in future releases of inputenc).
%
% The |.def| file may also define
% commands using the declarations:\\
% |\providecommand| or |\ProvideTextCommandDefault|.
% For example:
%\begin{verbatim}
% \ProvideTextCommandDefault{\textonequarter}{\ensuremath{\frac14}}
% \DeclareInputText{188}{\textonequarter}
%\end{verbatim}
% The use of the `provide' forms here will ensure that a
% better definition will not be over-written; their use is
% recommended since, in general, the best definition depends on the
% fonts available.
%
% See the documentation in |fntguide.tex| and |ltoutenc.dtx| for
% details of how to declare text commands.
%
%
% \subsection{UTF-8 encoding support}
%
%
% The Unicode UTF-8 support works differently. It too uses a |.def| file
% (i.e., |utf8.def|) but this file does not contain code point declarations
% via the commands |\DeclareInputText| or |\DeclareInputMath|.
% Instead it defines a number of
% parsing commands that parse UTF-8 characters and then provides the
% corresponding \LaTeX{} definitions (if possible).
%
% Unfortunately the number of Unicode characters that in theory could be
% contained in a document is enormous. Thus even with today's amount of
% computer memory it would be unrealistic to predefine all of them. Therefore the
% approach taken by \LaTeX{} is as follows:
% \begin{itemize}
% \item
% At the start of the document (|\begin{document}|) it examines all font
% encodings that are being used within the current document.
% \item
% For each such font encoding it loads all known UTF-8 mappings that generate
% characters from this font encoding.
% \item
% All other UTF-8 characters remain undefined and will produce an error
% message if they appear in the document.
% \end{itemize}
%
% The rationale behind this approach is that UTF-8 characters that do not
% correspond to any glyph within the used font encodings cannot be represented
% by \LaTeX{} anyway (without loading a font containing the glyph, which in
% turn should ``hopefully'' set up the corresponding UTF-8 mapping).
%
% This works well enough for the main Western languages for which \LaTeX{}
% has proper font encoding support, but currently already falls short on
% languages like Greek (which has some semi-official font support, but for
% which corresponding UTF-8 mappings still need to be defined).
%
% For some languages (such as Greek mentioned above) all that remains doing is
% to provide the necessary mappings and stick them into |utf8ienc.dtx|, so
% volunteers are welcome. For other languages that do not fit well into
% \LaTeX{} font selection scheme, e.g., Asian languages the outlined inputenc
% approach will not work. If that is the case one can try using Dominique
% Unruh's option |utf8x| for inputenc which has a somewhat different approach
% and encodes many more UTF-8 characters than the standard |utf8| option.
% However, we recommend to do so only if you really need such alphabets as
% there are problems with this extended approach which were precisely the
% reason that we decided to limit the support to what is properly supported
% within the boundaries of \LaTeX's font selection.
%
% If a UTF-8 mapping is missing and it is known to what \LaTeX{} definition it
% should map to, one can manually define it using a |\DeclareUnicodeCharacter|
% declaration. This declaration is available after inputenc has been loaded
% with the |utf8| option.
%
% The |\DeclareUnicodeCharacter| takes UTF-8 code point as its first argument
% (in form of a a hexadecimal number) and the definition that this maps to as
% its second argument. For example, the code point |00E4| which is
% ``LATIN SMALL LETTER A WITH DIAERESIS'' would be set up via:
%\begin{verbatim}
% \DeclareUnicodeCharacter{00E4}{\"a}
%\end{verbatim}
% Conceptually the second argument should only contain ``encoding-specific
% commands'' as defined by \LaTeX{} font encoding concept, i.e., commands that
% automatically change behavior if the font encoding changes (see chapter~7 of
% the \LaTeX{} Companion for details).
%
% For details of the mappings per font encoding and some more technical
% information see the file \texttt{utf8ienc.dtx} that provides UTF-8 support
% using the \textsf{inputenc} package interface.
%
%
%
%
% \subsection{Error messages}
%
% In certain situations the inputenc package generates one of the following
% three error messages.
%
% \subsubsection{\normalfont\ttfamily Keyboard character used is undefined in
% inputencoding `\meta{name}'}
%
% The document contains an 8-bit character that is not defined by the
% current input encoding in force. This means that either there is a
% mismatch between the document encoding that the document claims it
% is in (the option to inputenc) and the real encoding this document
% is encoded in. These days more often you find that UTF-8 is used as
% the encoding when saving a file in some text editor.
%
% Of course, it is also possible that the input encoding |.def| file is
% defective and the offending code point is simply missing from that file.
% Please check if the encoding file is one of the list above prior to
% reporting an error---on the net there are many additional encoding files
% supported by third parties.
%
%
%
% \subsubsection{\normalfont\ttfamily Cannot define Unicode char value < 00A0}
%
% This error message is shown if one tries to define a UTF-8 character
% with a code point lower than |00A0|. Those cannot be defined in
% \LaTeX{} through the |\DeclareUnicodeCharacter|.
%
%
% \subsubsection{\normalfont\ttfamily Unicode char \meta{charcode} not set up
% for use with LaTeX}
%
% This is the dreaded error message that one will receive if the
% document contains an UTF-8 character that isn't known to \LaTeX{}.
% It is quite possible that the character looks very unsuspicious and
% is rendered perfectly in the editor.
%
% For example, when entering a Euro symbol from the keyboard one may receive
% this error rather than a typeset symbol. But if this happens the reason is
% simply that the document doesn't load a font containing the Euro symbol,
% e.g., via the |textcomp| package. Thus \LaTeX{} does not know how to typeset
% one and therefore responds with this error message.
%
% However, even if \LaTeX{} can type that character in question it may not
% have been set up in which case you would need to do that yourself via
% |\DeclareUnicodeCharacter|. If you provide these declarations for a full
% font encoding then please contribute that work to this package so that
% others can benefit too.
%
%
%
%
% \subsection{Programmers interface}
%
% To better support packages that manage their own character mappings and
% therefore have to react to input encoding changes, the following three
% commands have been added in version 1.1a:
%
% \DescribeMacro\inputencodingname This command stores the name of the current
% input encoding.
%
% \DescribeMacro\inpenc@prehook
% \DescribeMacro\inpenc@posthook These two are token registers that are
% executed whenever an |\inputencoding| change happens. The first is executed at
% the very beginning, i.e., with |\inputencodingname| still pointing to the
% encoding name currently in place while the second one is executed at the very
% end, i.e., when |\inputencoding| has build a new mapping.
%
% Packages making use of this new features should consider including the
% following line
%\begin{verbatim}
% \NeedsTeXFormat{LaTeX2e}[2005/12/01]
%\end{verbatim}
% as these commands haven't been available in \textsf{inputenc} distributed
% with older releases of \LaTeX{}.
%
% \StopEventually{}
%
% \section{Announcing the files}
%
% We announce the files:
% \begin{macrocode}
%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<package>\ProvidesPackage{inputenc}
%<ascii> \ProvidesFile{ascii.def}
%<latin1> \ProvidesFile{latin1.def}
%<latin2> \ProvidesFile{latin2.def}
%<latin3> \ProvidesFile{latin3.def}
%<latin4> \ProvidesFile{latin4.def}
%<latin5> \ProvidesFile{latin5.def}
%<latin9> \ProvidesFile{latin9.def}
%<latin10> \ProvidesFile{latin10.def}
%<decmulti> \ProvidesFile{decmulti.def}
%<cp850> \ProvidesFile{cp850.def}
%<cp852> \ProvidesFile{cp852.def}
%<cp858> \ProvidesFile{cp858.def}
%<cp437> \ProvidesFile{cp437.def}
%<cp437de> \ProvidesFile{cp437de.def}
%<cp865> \ProvidesFile{cp865.def}
%<applemac> \ProvidesFile{applemac.def}
%<applemacce> \ProvidesFile{macce.def}
%<next> \ProvidesFile{next.def}
%<ansinew> \ProvidesFile{ansinew.def}
%<cp1252&!ansinew> \ProvidesFile{cp1252.def}
%<cp1250> \ProvidesFile{cp1250.def}
%<cp1257> \ProvidesFile{cp1257.def}
[2018/08/11 v1.3c Input encoding file]
%<cp850>%%
%<cp850>%% If you need a Euro symbol, try cp858 instead.
%<cp850>%%
% \end{macrocode}
%
% \section{The package}
%
% \changes{v0.99c}{2002/11/11}{Added cp858 (pr/3464)}
%
% \changes{v0.04}{1994/10/20}{Improved coding of \cs{DeclareInputText}
% and changed name from \cs{DeclareInputCharacter}.}
%
% \changes{v0.9g}{1995/10/19}{Replaced \cs{'} \cs{`} \cs{!=} by
% \cs{a'} \cs{a`} \cs{a!=} in order to get correct accents in
% a tabbing environment.}
%
% \changes{v0.9w}{1996/11/23}{Correct documentation
% of \cs{@tabacckludge}}
%
% \changes{v0.9x}{1997/03/21}{Use decimal rather than hex
% to avoid active character problems. latex/2451.}
%
% Before we start with the code, an important comment is in order:
% as you may or may not know, the |tabbing| environment changes the
% definition of the commands |\'|, |\`|, and |\=|. Outside such an
% environment these commands produce the corresponding accents, inside
% they are used for special text positioning, and the accents can be
% accessed using |\a'|, |\a`|, and |\a=|. Therefore we \emph{must} use
% the latter instead of the former in the second argument to
% |\DeclareInputText|, e.g. (from |latin1.def|):
% \begin{verbatim}
% \DeclareInputText{224}{\@tabacckludge`a}
%\end{verbatim}
% The command |\@tabacckludge| is defined (in |ltoutenc.dtx|) in such
% a way that |\@tabacckludge'| will expand to the internal form of |\'|.
% Thus it is |\'| that is carried around \emph{internally} (the
% same applies to the other two accent commands).
%
% \begin{macro}{\DeclareInputText}
% \begin{macro}{\DeclareInputMath}
% \begin{macro}{\IeC}
% These commands declare the expansion of an active character. The
% math declaration is the usual trick with |\uppercase|.
% The text declaration is sneakier, since in text space matters.
% We look to see if the definition ends in a macro, by checking
% whether it's |\meaning| ends in a space. If it does, then we
% add an irrelevant |\IeC| and braces around the definition, in
% order to avoid any space after the active char being gobbled up
% once the text is written out to an auxiliary file.
%
% The definition should contain only robust commands (and, for
% correct ligatures and kerning, they must be defined via the
% interfaces in the fontenc package).
%
% \changes{v0.9b}{1995/05/23}{Added hackery with \cs{IeC} in order to
% avoid space being gobbled.}
%
% \begin{macrocode}
%<*package>
\def\DeclareInputMath#1{%
\@inpenc@test
\bgroup
\uccode`\~#1%
\uppercase{%
\egroup
\def~%
}%
}
% \end{macrocode}
% \changes{v1.0a}{2003/01/17}{Now coding according to suggestion by David (pr/2004)}
% \changes{v1.0b}{2003/12/29}{but better do it properly}
% \changes{v1.0?}{2004/01/19}{or even correctly}
% \begin{macrocode}
\def\DeclareInputText#1#2{%
\def\reserved@a##1 ${}%
\def\reserved@b{#2}%
\ifcat_\expandafter\reserved@a\meaning\reserved@b$ $_%
\DeclareInputMath{#1}{#2}%
\else
\DeclareInputMath{#1}{\IeC{#2}}%
\fi
}
% \end{macrocode}
% The definition of |\IeC| was modified not to insert a |\protect|
% unless it is needed, this means it works in |\hyphenation|
% commands, and other such delicate places. It was then further
% changed to never insert a |\protect| as one is never needed; this
% makes it work in even more places.
%
% This still needs some attention.
%
% \changes{v0.9m}{1995/12/12}{Modified \cs{IeC} in order to
% work in \cs{hyphenation} latex/2004.}
%
% \changes{v0.94}{1997/12/17}{Changed non-typeset case from
% \cs{protect} to \cs{noexpand}: temporary fix.}
%
% \begin{macrocode}
\def\IeC{%
\ifx\protect\@typeset@protect
\expandafter\@firstofone
\else
\noexpand\IeC
\fi
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\inputencoding}
% \changes{v0.9q}{1996/05/09}
% {Allow characters below 32 for latex/2071}
% \changes{v0.9q}{1996/05/09}
% {Check the def file was reasonable for latex/2136}
% \changes{v0.94}{1997/12/17}{Changed to work only in outer vmode, see
% latex/2608}
% \changes{v0.94}{1997/12/17}{Warning message reworded and line
% number added, also for latex/2608}
% \changes{v0.95}{1997/12/20}{Changed to work in any vmode, for David}
% \changes{v1.2a}{2014/04/20}{Added alternative definition for xe/lua tex (pr/4024)}%
% \changes{v1.2b}{2014/04/30}{Allow (x-)ascii and utf8x aliases for utf8 in xetex/luatex}%
% \changes{v1.3a}{2018/03/24}{Make \cs{inputencoding} do nothing if
% the argument matches current encoding}%
% This sets the encoding to be |#1|. It first sets all the
% characters 128--255 to be active (and sets their initial
% definition to be |\@inpenc@undefined|).
% It now also does this for some `low' codes below 32, but
% misses out Null, control-I, control-J, control-L and control-M.
%
% It then inputs |#1.def|. But it first sets up a test that
% produces a warning message if no suitable definitions get read.
%
% \begin{macrocode}
\ifx\Umathchar\@undefined
% \end{macrocode}
%
% \begin{macrocode}
\def\inputencoding#1{%
\edef\reserved@a{#1}%
\ifx\reserved@a\inputencodingname
\else
% \end{macrocode}
% We start with a hook to be executed before the encoding change
% happens.
% \changes{v1.1a}{2006/02/22}{Added \cs{inpenc@prehook}}
% \begin{macrocode}
\the\inpenc@prehook
\gdef\@inpenc@test{\global\let\@inpenc@test\relax}%
% \end{macrocode}
% Keyboard characters which don't get a definition will be mapped to
% the command
% |\@inpenc@undefined| which gets a definition producing an error
% message indicating in which input encoding the current keyboard
% character is undefined:
% \changes{v0.98}{1998/07/04}{Give better error message if key used
% is undefined (pr/2845)}
% \changes{v0.993}{2000/01/24}{Fix error message for undefined chars
% (pr/3158)}
% \changes{v1.2a}{2014/04/20}{add \cs{protect} so undefined characters are robust (pr/4182)}%
% \begin{macrocode}
\edef\@inpenc@undefined{\noexpand\protect\noexpand\@inpenc@undefined@{#1}}%
% \end{macrocode}
% The |\edef| in the above definition is essential as |#1| may be
% |\CurrentOption| in which case a later use would return incorrect
% information (at best nothing).
%
% For external lookup by other packages we also store the new encoding name
% in a user accessible macro.
% \changes{v1.1a}{2006/02/22}{Added \cs{inputencodingname}}
% \begin{macrocode}
\edef\inputencodingname{#1}%
% \end{macrocode}
%
% Now we make all potential input characters active.
% \changes{v0.994}{2000/01/27}{Allow change also in horizontal mode
% (pr/2888)}
% \begin{macrocode}
\@inpenc@loop\^^A\^^H%
\@inpenc@loop\^^K\^^K%
\@inpenc@loop\^^N\^^_%
\@inpenc@loop\^^?\^^ff%
% \end{macrocode}
%
% To be able to process the input encoding file in horizontal mode
% we need to ensure that we don't get any stray spaces into the
% horizontal mode or else we end up with extra space in the
% paragraph.
% \changes{v0.998}{2001/05/25}{Suppress all spaces for horizontal mode
% (pr/3273)}
% \changes{v1.0f}{2004/05/06}{Really do (pr/3273)}
% \changes{v1.1d}{2007/08/06}{Set \cs{endlinechar} properly (pr/3926)}
% \changes{v1.1e}{2012/06/06}{Save and restore \cs{catcode} of @ (pr/4192)}
% \changes{v1.2c}{2015/03/17}{Save and restore \cs{catcode} of percent (pr/4420)}
% \begin{macrocode}
\xdef\saved@endlinechar@code{\the\endlinechar}%
\endlinechar\m@ne
\xdef\saved@space@catcode{\the\catcode`\ }%
\catcode`\ 9\relax
\xdef\saved@at@catcode{\the\catcode`\@}%
\makeatletter
\xdef\saved@percent@catcode{\the\catcode`\%}%
\catcode`\%14\relax
\input{#1.def}%
\endlinechar\saved@endlinechar@code\relax
\catcode`\ \saved@space@catcode\relax
\catcode`\@\saved@at@catcode\relax
\catcode`\%\saved@percent@catcode\relax
% \end{macrocode}
%
% If there have been no |\DeclareInputText| or |\DeclareInputMath|
% commands read then something is amiss.
% \begin{macrocode}
\ifx\@inpenc@test\relax\else
\PackageWarning{inputenc}%
{No characters defined\MessageBreak
by input encoding change to `#1'\MessageBreak}%
\fi
% \end{macrocode}
% We finish with a hook to be executed after the encoding change
% happens.
% \changes{v1.1a}{2006/02/22}{Added \cs{inpenc@posthook}}
% \begin{macrocode}
\the\inpenc@posthook
% \end{macrocode}
%
% \begin{macrocode}
\fi
}
% \end{macrocode}
%
% \begin{macrocode}
\else
% \end{macrocode}
% Unicode based TeX engines do not require this package at all, and always use UTF-8
% input. Allow the package to be used if |[utf8]| or |[ascii]| options are used to simplify
% switching between TeX engines.
% \begin{macrocode}
\def\inputencoding#1{%
\edef\reserved@a{#1}%
\def\reserved@b{utf8x}%
\ifx\reserved@a\reserved@b\def\reserved@a{utf8}\fi
\def\reserved@b{utf8}%
\ifx\reserved@a\reserved@b
\PackageWarningNoLine
{inputenc}%
{inputenc package ignored with utf8 based engines}%
\else
\def\reserved@b{x-ascii}%
\ifx\reserved@a\reserved@b\def\reserved@a{ascii}\fi
\def\reserved@b{ascii}%
\ifx\reserved@a\reserved@b
\PackageWarningNoLine
{inputenc}%
{inputenc can't be used to ensure 7bit clean source\MessageBreak
with a utf engine: Package ignored: utf8 assumed}%
\else
\PackageError
{inputenc}%
{inputenc is not designed for xetex or luatex.\MessageBreak
only UTF-8 supported}%
{For xelatex or lualatex save the document in UTF-8 encoding\MessageBreak
and do not use inputenc, or use the [utf8] option.}
\fi
\fi
}
\fi
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\inpenc@prehook}
% \changes{v1.1a}{2006/02/22}{Hook added}
% \begin{macro}{\inpenc@posthook}
% \changes{v1.1a}{2006/02/22}{Hook added}
% Two hooks to be executed before and after an encoding changes happened.
% \begin{macrocode}
\ifx\inpenc@prehook\@undefined\newtoks\inpenc@prehook\fi
\ifx\inpenc@posthook\@undefined\newtoks\inpenc@posthook\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@inpenc@undefined@}
% This command will assigned to any active character unless it
% get a proper definition by the encoding. The argument is the
% current encoding name.
% \changes{v0.993}{2000/01/24}{Fix error message for undefined chars
% (pr/3158)}
% \begin{macrocode}
\def\@inpenc@undefined@#1{\PackageError{inputenc}%
{Keyboard character used is undefined\MessageBreak
in inputencoding `#1'}%
{You need to provide a definition with
\noexpand\DeclareInputText\MessageBreak or
\noexpand\DeclareInputMath before using this key.}}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@inpenc@loop}
% \changes{v0.9q}{1996/05/09}
% {Macro added}
% \changes{v0.9v}{1996/11/07}
% {Exit from the top of loop fixed for latex/2257}
% Make characters |#1| to |#2| inclusive active and undefined.
% \begin{macrocode}
\def\@inpenc@loop#1#2{%
\@tempcnta`#1\relax
\loop
\catcode\@tempcnta\active
\bgroup
\uccode`\~\@tempcnta
\uppercase{%
\egroup
\let~\@inpenc@undefined
}%
\ifnum\@tempcnta<`#2\relax
\advance\@tempcnta\@ne
\repeat}
% \end{macrocode}
% \end{macro}
%
%
% Then for each option, we input that encoding file.
% Only exception: for utf8x (from \texttt{ucs} package) we
% first restore the raw input encoding. That should be moved to the
% \texttt{utf8x.def} file, eventually.
% In case of a rollback |\UseRawInputEncoding| is not defined so we
% only input the encoding.
% \changes{v1.3b}{2018/04/06}{Handle utf8x encoding manually for now}
% \begin{macrocode}
\DeclareOption{utf8x}{\ifdefined\UseRawInputEncoding
\UseRawInputEncoding
\fi
\inputencoding{\CurrentOption}}
\DeclareOption*{\inputencoding{\CurrentOption}}
\ProcessOptions
%</package>
% \end{macrocode}
%
%
% \section{Default definitions for characters}
%
% Some input characters map to internal functions which are not in
% either the |T1| or |OT1| font encoding. For this reason default
% definitions are provided in the encoding file: these will be
% used unless some other output encoding is used which supports
% those glyphs. In some cases this default definition has to be
% simply an error message.
%
% Note that this works reasonably well only because the encoding
% files for both |OT1| and |T1| are loaded in the standard LaTeX
% format.
%
% \changes{v0.9a}{1995/04/23}{Default settings moved to own section}
%
% \changes{v0.9b}{1995/05/23}{Corrected ordmasc and ordfem which had
% been switched by mistake.}
%
% \changes{v0.9k}{1995/11/29}{Moved \cs{textregistered} and
% \cs{texttrademark} to the kernel.}
% \changes{v0.9k}{1995/11/29}{Added default commands for Next input
% encoding.}
%
% \changes{v0.9m}{1995/12/04}{Added \cs{ensuremath} to definitions of
% the fraction glyphs.}
%
% \changes{v0.9t}{1996/10/28}
% {Added \cs{textblacksquare}}
% \changes{v0.9u}{1996/10/29}
% {Corrected code for \cs{textblacksquare}}
%
% \changes{v0.9u}{1996/10/29}
% {Added cp865 and corrected cp850, cp852 and cp437 guards}
% \changes{v0.94}{1997/12/17}{Removed entries that were solely in
% next.def}
% \changes{v0.995}{2000/05/22}{Added latin2 option for textdegree
% (pr/3207) CAR}
%
% \changes{v1.3c}{2018/08/11}{Use \cs{guillemetleft} and \cs{guillemetright}
% instead of old Adobe names in all encoding files}
%
% The name |\textblacksquare| is derived from the AMS symbol name since
% Adobe seem not to want this symbol. The default definition, as a
% rule, makes no claim to being a good design.
%
% Some entries are repeated in case guards must all be on one line.
% \begin{macrocode}
%<*latin1|decmulti|latin2|latin3|latin4|latin5|latin9|applemacce|latin10>
\ProvideTextCommandDefault{\textdegree}{\ensuremath{{^\circ}}}
%</latin1|decmulti|latin2|latin3|latin4|latin5|latin9|applemacce|latin10>
%<*cp850|cp858|cp852|cp865|cp437|cp437de|applemac|cp1252|cp1250|cp1257|next>
\ProvideTextCommandDefault{\textdegree}{\ensuremath{{^\circ}}}
%</cp850|cp858|cp852|cp865|cp437|cp437de|applemac|cp1252|cp1250|cp1257|next>
%<*latin1|decmulti|latin3|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
\ProvideTextCommandDefault{\textonehalf}{\ensuremath{\frac12}}
%</latin1|decmulti|latin3|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
%<*latin1|decmulti|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
\ProvideTextCommandDefault{\textonequarter}{\ensuremath{\frac14}}
%</latin1|decmulti|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
%<*latin1|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
\ProvideTextCommandDefault{\textthreequarters}{\ensuremath{\frac34}}
%</latin1|latin5|cp850|cp858|cp852|cp1252|cp1257|next>
%<*applemac|cp850|cp858|cp865|cp437|cp437de|cp1252|next>
\ProvideTextCommandDefault{\textflorin}{\textit{f}}
%</applemac|cp850|cp858|cp865|cp437|cp437de|cp1252|next>
%<*cp865|cp437|cp437de>
\ProvideTextCommandDefault{\textpeseta}{Pt}
%</cp865|cp437|cp437de>
%<*cp850|cp858|cp852|cp865|cp437|cp437de>
\ProvideTextCommandDefault{\textblacksquare}
{\vrule \@width .3em \@height .4em \@depth -.1em\relax}
%</cp850|cp858|cp852|cp865|cp437|cp437de>
% \end{macrocode}
%
% \changes{v0.9k}{1995/11/29}{Added error messages for unavailable
% characters.}
%
% Some commands can't be faked, so we have them generate an error
% message.
% \begin{macrocode}
%<*latin1|decmulti|latin5|latin9|cp850|cp858|cp865|cp437|cp437de>
\ProvideTextCommandDefault{\textcent}
{\TextSymbolUnavailable\textcent}
\ProvideTextCommandDefault{\textyen}
{\TextSymbolUnavailable\textyen}
%</latin1|decmulti|latin5|latin9|cp850|cp858|cp865|cp437|cp437de>
%<*applemac|cp1252|next>
\ProvideTextCommandDefault{\textcent}
{\TextSymbolUnavailable\textcent}
\ProvideTextCommandDefault{\textyen}
{\TextSymbolUnavailable\textyen}
%</applemac|cp1252|next>
%<*cp1257>
\ProvideTextCommandDefault{\textcent}
{\TextSymbolUnavailable\textcent}
%</cp1257>
%<*latin9|cp1252|cp1257|latin10>
\ProvideTextCommandDefault{\texteuro}
{\TextSymbolUnavailable\texteuro}
%</latin9|cp1252|cp1257|latin10>
%<*latin1|decmulti|latin2|latin3|latin4|latin5|cp850|cp858|cp852|cp865>
\ProvideTextCommandDefault{\textcurrency}
{\TextSymbolUnavailable\textcurrency}
%</latin1|decmulti|latin2|latin3|latin4|latin5|cp850|cp858|cp852|cp865>
%<*applemac|cp1252|cp1250|cp1257|next>
\ProvideTextCommandDefault{\textcurrency}
{\TextSymbolUnavailable\textcurrency}
%</applemac|cp1252|cp1250|cp1257|next>
%<*latin1|latin5|cp850|cp858|cp852|cp1252|cp1250|cp1257>
\ProvideTextCommandDefault{\textbrokenbar}
{\TextSymbolUnavailable\textbrokenbar}
%</latin1|latin5|cp850|cp858|cp852|cp1252|cp1250|cp1257>
%<*latin3>
\ProvideTextCommandDefault{\textmalteseH}
{\TextSymbolUnavailable\textmalteseH}
\ProvideTextCommandDefault{\textmalteseh}
{\TextSymbolUnavailable\textmalteseh}
%</latin3>
%<*latin4>
\ProvideTextCommandDefault{\textkra}
{\TextSymbolUnavailable\textkra}
\ProvideTextCommandDefault{\textTstroke}
{\TextSymbolUnavailable\textTstroke}
\ProvideTextCommandDefault{\texttstroke}
{\TextSymbolUnavailable\texttstroke}
%</latin4>
%<*cp1250|cp1252|cp1257|applemac|next>
\ProvideTextCommandDefault{\textperthousand}
{\TextSymbolUnavailable\textperthousand}
%</cp1250|cp1252|cp1257|applemac|next>
%<*applemacce>
\ProvideTextCommandDefault{\textdiv}
{\TextSymbolUnavailable\textdiv}
%</applemacce>
% \end{macrocode}
%
% \changes{v0.9l}{1995/12/01}{Removed extraneous braces from the
% `superior' glyphs.}
% \changes{v0.97}{1998/03/05}{Removed ords:
% changed to text chars, pr/2579}
%
% Characters that are supposed to be used only in math will be defined
% by |\providecommand| because \LaTeXe{} assumes that the font
% encoding for math fonts is static.
%
% \begin{macrocode}
%<*latin1|decmulti|latin5|latin9|cp850|cp858|cp1252|cp1257|next>
\providecommand{\mathonesuperior}{{^1}}
%</latin1|decmulti|latin5|latin9|cp850|cp858|cp1252|cp1257|next>
%<*latin1|decmulti|latin3|latin5|latin9|cp850|cp858|cp1252|cp1257|next>
\providecommand{\maththreesuperior}{{^3}}
%</latin1|decmulti|latin3|latin5|latin9|cp850|cp858|cp1252|cp1257|next>
%<*latin1|decmulti|latin3|latin5|latin9|cp850|cp858|cp865|cp437|cp437de>
\providecommand{\mathtwosuperior}{{^2}}
%</latin1|decmulti|latin3|latin5|latin9|cp850|cp858|cp865|cp437|cp437de>
%<*cp1252|cp1257|next>
\providecommand{\mathtwosuperior}{{^2}}
%</cp1252|cp1257|next>
%<*cp865|cp437|cp437de>
\providecommand{\mathnsuperior}{{^n}}
%</cp865|cp437|cp437de>
% \end{macrocode}
%
% \section{The ASCII encoding}
%
% The ASCII encoding only allows characters in the range 32--127, so
% we only need to provide a more or less empty |.def| file.
% But we suppress the warning that would normally appear if there are no
% encoding definitions.
%
% \changes{v1.1b}{2006/03/03}{Suppress unnecessary warning (pr/3849)}
% \begin{macrocode}
%<ascii>\@inpenc@test
% \end{macrocode}
%
% \changes{v0.94}{1997/12/17}{Merged latin1 with ansinew/cp1252}
%
% \section{The ISO Latin-2 encoding}
%
% The ISO Latin-2 encoding file defines the characters
% in the ISO 8859-2 encoding. It was contributed by
% Petr Sojka (\texttt{[email protected]}) with small technical
% updates by Frank Mittelbach.
%
% \changes{v0.9e}{1995/08/31}{Redeclared "AD to be soft hyphen.}
% \changes{v0.91}{1997/08/19}{Replaced \cs{dh}/\cs{DH} by
% \cs{dj}/\cs{DJ}.}
% \changes{v0.94}{1997/12/17}{Changed 176 to \cs{textdegree}}
%
% \begin{macrocode}
%<*latin2>
\DeclareInputText{160}{\nobreakspace}
\DeclareInputText{176}{\textdegree}
\DeclareInputText{161}{\k A}
\DeclareInputText{177}{\k a}
\DeclareInputText{162}{\u{}}
\DeclareInputText{178}{\k\ }
\DeclareInputText{163}{\L}
\DeclareInputText{179}{\l}
\DeclareInputText{164}{\textcurrency}
\DeclareInputText{180}{\@tabacckludge'{}}
\DeclareInputText{165}{\v L}
\DeclareInputText{181}{\v l}
\DeclareInputText{166}{\@tabacckludge'S}
\DeclareInputText{182}{\@tabacckludge's}
\DeclareInputText{167}{\S}
\DeclareInputText{183}{\v{}}
\DeclareInputText{168}{\"{}}
\DeclareInputText{184}{\c\ }
\DeclareInputText{169}{\v S}
\DeclareInputText{185}{\v s}
\DeclareInputText{170}{\c S}
\DeclareInputText{186}{\c s}
\DeclareInputText{171}{\v T}
\DeclareInputText{187}{\v t}
\DeclareInputText{172}{\@tabacckludge'Z}
\DeclareInputText{188}{\@tabacckludge'z}
\DeclareInputText{173}{\-}
\DeclareInputText{189}{\H{}}
\DeclareInputText{174}{\v Z}
\DeclareInputText{190}{\v z}
\DeclareInputText{175}{\.Z}
\DeclareInputText{191}{\.z}
% \end{macrocode}
%
% \begin{macrocode}
\DeclareInputText{192}{\@tabacckludge'R}
\DeclareInputText{208}{\DJ}
\DeclareInputText{193}{\@tabacckludge'A}
\DeclareInputText{209}{\@tabacckludge'N}
\DeclareInputText{194}{\^A}
\DeclareInputText{210}{\v N}
\DeclareInputText{195}{\u A}
\DeclareInputText{211}{\@tabacckludge'O}
\DeclareInputText{196}{\"A}
\DeclareInputText{212}{\^O}
\DeclareInputText{197}{\@tabacckludge'L}
\DeclareInputText{213}{\H O}
\DeclareInputText{198}{\@tabacckludge'C}
\DeclareInputText{214}{\"O}
\DeclareInputText{199}{\c C}
\DeclareInputMath{215}{\times}
\DeclareInputText{200}{\v C}
\DeclareInputText{216}{\v R}
\DeclareInputText{201}{\@tabacckludge'E}