2 %% This is file `ucs.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% ucs.dtx (with options: `ucs.sty')
9 %% Copyright 2001 Dominique Unruh <dominique@unruh.de>
11 %% This program is provided under the terms of the LaTeX Project Public
12 %% License with some modifications.
13 %% See the file LICENSE (http://www.unruh.de/DniQ/latex/unicode/content/LICENSE)
17 \ifx\@gobble\undefined\def\@gobble#1{}\fi
18 \ifx\@gobbletwo\undefined\def\@gobbletwo#1#2{}\fi
19 \ifx\@gobblethree\undefined\def\@gobblethree#1#2#3{}\fi
20 \ifx\@gobblefour\undefined\def\@gobblefour#1#2#3#4{}\fi
21 \ifx\@firstofone\undefined\def\@firstofone#1{#1}\fi
22 \ifx\@tempcnta\undefined\csname newcount\endcsname\@tempcnta\fi
23 \ifx\@tempcntb\undefined\csname newcount\endcsname\@tempcntb\fi
24 \ifx\@testopt\undefined
26 \@ifnextchar[{#1}{#1[{#2}]}}\fi
27 \ifx\@protected@testopt\undefined\def\@protected@testopt{\expandafter\@testopt\@gobble}\fi
28 \ifx\@ifnextchar\undefined
29 \def\@ifnextchar#1#2#3{%
33 \futurelet\@let@token\@ifnch}\fi
36 \ifx\@let@token\@sptoken
37 \let\reserved@c\@xifnch
39 \ifx\@let@token\reserved@d
40 \let\reserved@c\reserved@a
42 \let\reserved@c\reserved@b
46 \ifx\@inputcheck\undefined\newread\@inputcheck\fi
47 \ifx\IfFileExists\undefined
48 \long\def\IfFileExists#1#2#3{%
49 \openin\@inputcheck#1 %SPACE
50 \ifeof\@inputcheck\def\reserved@a{#3}%
51 \else\closein\@inputcheck\def\reserved@a{#2}%
55 \ifx\InputIfFileExists\undefined
56 \long\def\InputIfFileExists#1#2{%
57 \IfFileExists{#1}{#2\input #1 }}
59 \ifx\protect\undefined\let\protect\relax\fi
60 \ifx\@typeset@protect\undefined\let\@typeset@protect\relax\fi
61 \ifx\IeC\undefined\def\IeC{\ifx\protect\@typeset@protect
62 \expandafter\@firstofone\else\noexpand\IeC\fi}\fi
63 \def\unicode@knownoptions{}
64 \def\XDeclareUnicodeOption#1#2#3#4#5{%
65 \expandafter\let\csname ifUnicodeOption#2\endcsname\iffalse
66 \expandafter\def\csname UnicodeOption#2true%
67 \expandafter\endcsname\expandafter{%
68 \expandafter\let\csname ifUnicodeOption#2\endcsname\iftrue}%
69 \expandafter\def\csname UnicodeOption#2false%
70 \expandafter\endcsname\expandafter{%
71 \expandafter\let\csname ifUnicodeOption#2\endcsname\iffalse}%
72 \expandafter\def\csname @unicode@option@#2\endcsname{%
73 #3\uni@activate@option{#2}{}{#4}{#5}}%
74 \expandafter\def\csname @unicode@option@no#2\endcsname{%
75 #3\uni@activate@option{#2}{no}{#4}{#5}}%
76 \ifx~#1~\else\LinkUnicodeOptionToPkg{#2}{#1}\fi
77 \let\uc@tempa\\\let\\\relax
78 \edef\unicode@knownoptions{\\{#2}\unicode@knownoptions}%
81 \let\uc@newcommand\def
82 \uc@newcommand\DeclareUnicodeOption{\@protected@testopt\DeclareUnicodeOption\DeclareUnicodeOption@{}}
83 \uc@newcommand\DeclareUnicodeOption@[#1]#2{%
84 \XDeclareUnicodeOption{#1}{#2}{}{}{}}%
85 \uc@newcommand\uc@errormsg#1#2{%
86 \ifx\PackageError\undefined
87 {\newlinechar`\^^J\def\MessageBreak{^^J}%
88 \errhelp{#2}\errmessage{Package ucs: #1}}%
90 \PackageError{ucs}{#1}{#2}%
93 \uc@newcommand\uc@warnmsg#1{%
94 \ifx\PackageWarning\undefined
95 {\newlinechar`\^^J\def\MessageBreak{^^J}%
96 \message{Package ucs: #1\MessageBreak}}%
98 \PackageWarning{ucs}{#1}%
101 \def\uni@activate@option#1#2#3#4#5{%
102 \ifx\uni@dataloaded\undefined
103 \global\expandafter\def\csname @unicode@option@#1\endcsname##1{%
104 \csname UnicodeOption#1true\endcsname
105 \expandafter\def\csname uo-prio-#1\endcsname{##1}#3}%
106 \global\expandafter\def\csname @unicode@option@no#1\endcsname##1%
107 {\csname UnicodeOption#1false\endcsname#4}%
108 \global\expandafter\let\csname uni@active@#1\endcsname1%
109 \csname @unicode@option@#2#1\endcsname{#5}\else
110 \uc@errormsg{Option #1 must be activated or deactivated %SPACE
111 at least once in the preamble before using it in the document}{%
112 For optimization causes I must know all %SPACE
113 options before loading any unicode data.\MessageBreak
114 Try e.g. #1 or no#1 as package option to ucs.}\fi}
115 \def\LinkUnicodeOptionToPkg#1#2{%
116 \AtBeginDocument{\@ifpackageloaded{#2}{\SetUnicodeOption{#1}}{}}}%
117 \uc@newcommand\SetUnicodeOption{\@protected@testopt\SetUnicodeOption\SetUnicodeOption@{100}}
118 \uc@newcommand\SetUnicodeOption@[#1]#2{%
119 \edef\uc@temp@a{@unicode@option@#2}%
120 \expandafter\ifx\csname\uc@temp@a\endcsname\relax
121 \PackageError{ucs}{Unknown unicode option #2}{}%
123 \csname\uc@temp@a\endcsname{#1}%
125 \ifx\ProvidesPackage\undefined\else
126 \ProvidesPackage{ucs}[2004/10/17 UCS: Unicode input support]%
128 \ifx\@@input\undefined\input uni-global.def \else\input{uni-global.def}\fi
129 \DeclareUnicodeOption{fasterrors}
130 \DeclareUnicodeOption{warnunknown}
131 \DeclareUnicodeOption{graphics}
132 \DeclareUnicodeOption{savemem}
133 \DeclareUnicodeOption{document}
134 \SetUnicodeOption[1000]{document}
135 \DeclareUnicodeOption{default}
136 \SetUnicodeOption[0]{default}
137 \XDeclareUnicodeOption{}{combine}{}{%
139 \ifx\unicodecombine\undefined\else\unicodecombine\fi
140 \def\uc@cmb{\uc@warn@nocombine}}%
141 \ifx\AtBeginDocument\undefined\else
142 \AtEndDocument{\unicodecombine}\fi
143 \SetUnicodeOption{nocombine}%
144 \def\uc@cmb{\uc@warn@nocombine}%
145 \ifx\DeclareOption\undefined\else
146 \DeclareOption{showmagickern}{\def\uc@magic@glue{6805678}}%
147 \DeclareOption{hyperref}{\AtEndOfPackage{\RequirePackage{ucshyper}}}%
148 \DeclareOption*{\SetUnicodeOption{\CurrentOption}}\ProcessOptions*
150 \ifx\AtBeginDocument\undefined
151 \uc@warnmsg{Not loading ucsencs.def automatically.\MessageBreak
152 Please load it after initializing fontencodings}%
154 \AtBeginDocument{\input{ucsencs.def}}\fi
155 \AtBeginDocument{\ifUnicodeOptiongraphics\RequirePackage{graphicx}\fi}%
156 \uc@newcommand\unicode@numtohex{\protect\unicode@numtohex@}%
157 \uc@newcommand\unicode@numtohex@#1#2#3{%
158 {%\let\empty\relax\relax
159 %\ifx\empty\relax\def\empty{}%
160 \count255=#2\relax\gdef#1{}%
163 \count253=\count252\advance\count253by\count255\relax
165 \ifnum\count252>0\advance\count252by-1\relax\fi
167 \divide\count255by16%
168 \multiply\count255by16%
169 \advance\count254by-\count255%
170 \xdef#1{\ifcase\count254 0\or1\or2\or3\or4\or5\or6\or7\or
171 8\or9\or A\or B\or C\or D\or E\or F\fi#1}%
172 \divide\count255by16\relax
179 \newcount\uc@secondtry
180 \uc@newcommand\unicode@invalid#1{%
182 \ifUnicodeOptiongraphics{%
183 \ifx\unicode@graphicsdir\undefined
184 \def\unicode@graphicsdir{ucs-glyphs}\fi
185 \ifx\unicode@graphicscmd\undefined
186 \def\unicode@graphicscmd{ucs-getglyph \hex\space \dec\space \path\space}\fi
187 \unicode@numtohex\hex{#1}4%
189 \divide\count255 by256\relax
190 \unicode@numtohex\uc@temp@b{\count255}2%
191 \edef\path{\unicode@graphicsdir/\uc@temp@b/U\hex.ps}%
192 \edef\dec{\number#1}%
193 \IfFileExists{\uc@temp@c}{}{%
194 \typeout{Running: \unicode@graphicscmd}%
195 \immediate\write18{\unicode@graphicscmd}%
197 \IfFileExists{\path}{%
199 \edef\uc@temp@b{\begingroup\noexpand\uni@resetcatcodes
200 \noexpand\includegraphics[height=\the\ht255, trim=0 22.5 0 17.5]%
202 \noexpand\ProvidesFile{U\hex.ps}%
203 [Downloaded glyph for U+\hex]%
205 \typeout{\meaning\uc@temp@b}%
206 \expandafter\unicodevirtual\expandafter{\uc@temp@b}%
208 \PackageWarning{ucs}{File \uc@temp@d\uc@temp@c.ps %SPACE
209 not found.\MessageBreak
211 \space\space\space\space\unicode@graphicscmd\MessageBreak
212 or start latex with option -shell-escape\MessageBreak
213 if you have not already done so.}%
214 \unicodevirtual{\unicode@invalidglyph{#1}}}}\else
215 \unicodevirtual{\unicode@invalidglyph{#1}}\fi}
216 \uc@newcommand\unicode@invalidglyph#1{%
217 {\unicode@numtohex\uc@temp@d{#1}4%
218 \fontencoding{OT1}\texttt{[U+\uc@temp@d]}}}
219 \uc@newcommand\uni@char#1{%
220 \ucs@protected@unichar\iftrue
221 \expandafter\ifx\csname u-\number#1-h/o\endcsname\relax
223 % If the character is not defined yet, load it.
226 % In case \let is not executed, this (until ===) expands
227 % to \let\relax\relax,
228 % otherwise we have \let\uc@notloaderr\@gobble
229 % Number of \empty's must equal number of args of \uc@char@notloaded
230 \let\uc@notloaderr\@gobble\empty\@gobbletwo\relax\relax
232 \expandafter\endgroup
233 % If \let not executed: Warning is emitted (see |\uc@notloaderr|)
234 % otherwise: |\uc@char@notloaded| is called.
235 \uc@notloaderr{\number#1}\uc@char@notloaded{#1}%
238 % If the character is loaded, run |\uc@checkopts|
239 % with the options of this character
240 % as first arg and the code position as second; this will
241 % display the character with
242 % the correct option.
244 \expandafter\expandafter\expandafter\uc@checkopts
245 \expandafter\expandafter\expandafter
246 {\csname u-\number#1-h/o\endcsname}{#1}%
249 \noexpand\unichar{#1}%
253 \lccode`\A=`\{\lccode`\B=`\}\lccode`\C=`\\%
254 \lccode`\P=`\P\lccode`\U=`\U%
257 \uc@newcommand\uc@notloaderr#1#2#3{%
258 \ifx\@gobble#1\else[Please insert %SPACE
259 CPrerenderUnicodeACunicharA#1BB into preamble]\fi}}
260 \uc@newcommand\uc@checkopts#1#2{%
261 \expandafter\uc@checkopt@error\expandafter{\number#2}%
262 {error}{error}{infinity}#1\@nil
264 \expandafter\uc@newcommand\csname uo-prio-infinity\endcsname{-2100000000}
265 %% === BEGIN AUTOGENERATED CODE
266 \uc@newcommand\uc@checkopt@stick#1#2#3#4#5{%
268 \expandafter\ifx\csname u-#2-#1\endcsname\relax
269 \uc@localdeferr{#1}{#2}%
271 \uc@output{\csname u-#2-#1\endcsname}{#1}%
273 \expandafter\@gobblefour
275 \iftrue\csname fi\endcsname
276 \csname ifUnicodeOption#5\endcsname
277 \ifnum\csname uo-prio-#2\endcsname>\csname uo-prio-#5\endcsname\uc@spc
278 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
281 \ifnum\csname uo-prio-#2\endcsname<\csname uo-prio-#5\endcsname\uc@spc
282 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
283 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
286 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
287 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
292 \expandafter\expandafter\expandafter\uc@checkopt@stick
297 \uc@newcommand\uc@checkopt@change#1#2#3#4#5{%
299 \expandafter\ifx\csname u-#3-#1\endcsname\relax
300 \uc@localdeferr{#1}{#3}%
302 \uc@output{\csname u-#3-#1\endcsname}{#1}%
304 \expandafter\@gobblefour
306 \iftrue\csname fi\endcsname
307 \csname ifUnicodeOption#5\endcsname
308 \ifnum\csname uo-prio-#3\endcsname>\csname uo-prio-#5\endcsname\uc@spc
309 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
312 \ifnum\csname uo-prio-#3\endcsname<\csname uo-prio-#5\endcsname\uc@spc
313 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
314 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
317 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
318 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
323 \expandafter\expandafter\expandafter\uc@checkopt@stick
328 \uc@newcommand\uc@checkopt@error#1#2#3#4#5{%
330 \uc@errordrawopt{#1}{#2, #3}{#4}%
331 \expandafter\@gobblefour
333 \iftrue\csname fi\endcsname
334 \csname ifUnicodeOption#5\endcsname
335 \ifnum\csname uo-prio-#4\endcsname>\csname uo-prio-#5\endcsname\uc@spc
336 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
337 \uc@checkopt@errorstick
339 \ifnum\csname uo-prio-#4\endcsname<\csname uo-prio-#5\endcsname\uc@spc
340 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
341 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
344 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
345 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
350 \expandafter\expandafter\expandafter\uc@checkopt@errorstick
353 {#1}{#2, #3}{#5}{#4}%
355 \uc@newcommand\uc@checkopt@errorstick#1#2#3#4#5{%
357 \uc@errordrawopt{#1}{#2}{#4}%
358 \expandafter\@gobblefour
360 \iftrue\csname fi\endcsname
361 \csname ifUnicodeOption#5\endcsname
362 \ifnum\csname uo-prio-#4\endcsname>\csname uo-prio-#5\endcsname\uc@spc
363 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
364 \uc@checkopt@errorstick
366 \ifnum\csname uo-prio-#4\endcsname<\csname uo-prio-#5\endcsname\uc@spc
367 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
368 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
371 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
372 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
377 \expandafter\expandafter\expandafter\uc@checkopt@errorstick
382 \let\unicode@empty\empty
383 \uc@newcommand\uc@errordrawopt#1#2#3{%
384 \let\unicode@empty\relax\relax
385 \ifx\unicode@empty\relax\let\unicode@empty\empty
386 \unicode@numtohex\uc@temp@b{#1}4%
387 \ifnum\csname uo-prio-#3\endcsname=-2100000000\relax
388 \expandafter\ifx\csname
389 missing-unicode-warned-\number#1\endcsname\relax
390 \global\expandafter\let\csname
391 missing-unicode-warned-\number#1\endcsname\@ne
392 \unicode@error@unknown\@ne{Character \number#1\uc@spc
393 \uc@spc= U+\uc@temp@b\uc@spc
394 matches no activated options.\MessageBreak
395 Type H to see available options}{#1}%
397 \PackageWarning{ucs}{Character % SPACE
398 \number#1 \uc@spc= 0x\uc@temp@b\uc@spc
402 \@getcharinfo\uc@temp@c{#1}%
403 \PackageWarning{ucs}{Character %SPACE
404 \number#1 \uc@spc= 0x\uc@temp@b\uc@spc
405 matches options\MessageBreak
406 \uc@spc\uc@spc\uc@spc#2\MessageBreak
407 with same priority \csname uo-prio-#3\endcsname. %SPACE
408 Selecting option #3.\MessageBreak
410 \uc@output{\csname u-#3-#1\endcsname}{#1}%
413 \noexpand\unichar{#1}%
416 \uc@newcommand\uc@output#1#2{%
417 \ifx\unicode@delay1\let\unicode@delay\relax\else
418 \ifUnicodeOptioncombine
419 \expandafter\uc@combine\expandafter{#1}{#2}%
421 \uc@prechar@exec{#2}%
422 \unicode@charfilter{#1{}}%
424 \ifx\uc@throw\undefined\else
425 \def\uc@got{#2}\uc@throw\global\let\uc@throw\undefined\fi
428 \uc@newcommand\uc@prechar@exec#1{%
429 \ifx\uc@prechar\undefined\else\uc@prechar{#1}\fi}
430 \uc@newcommand\uc@localdeferr#1#2{%
431 \@getcharinfo\uc@temp@a{#1}%
432 \PackageError{ucs}{Internal error in character \number#1, %SPACE
433 option #2}{I probably got confused by intermixed local %SPACE
434 and global definitions.\MessageBreak Try to load the needed %SPACE
435 code page via \noexpand\PreloadUnicodePage
436 before declaring anything by yourself.}{\uc@temp@a}%
437 \unicode@invalid{#1}%
439 \uc@newcommand\uc@warn@nocombine{%
440 \PackageError{ucs}{Please activate option 'combine'}{Composed %SPACE
441 characters can only be rendered correctly, when the option %SPACE
442 'combine' is activated}}
444 \newtoks\uc@combtoksb
445 \newtoks\uc@temptokena
446 \uc@newcommand\unicode@combine{%
448 \ifx\uc@combining@prechar\undefined\global\let\uc@comb@code\undefined\fi
449 \ifx\uc@comb@code\undefined\uc@temptokena{}\else
450 \uc@temptokena\expandafter{\expandafter\uc@prechar@exec
451 \expandafter{\uc@comb@code}}\fi%
452 \global\let\uc@comb@code\undefined
453 \global\expandafter\expandafter\expandafter\expandafter\expandafter
454 \expandafter\expandafter\uc@combtoksb
455 \expandafter\expandafter\expandafter
456 \expandafter\expandafter\expandafter\expandafter{%
457 \expandafter\expandafter\expandafter\the
458 \expandafter\expandafter\expandafter\uc@combtoksb
459 \expandafter\the\expandafter\uc@temptokena\the\uc@combtoks}%
460 \global\uc@combtoks{}}
461 \def\uc@magic@glue{5381}
462 \uc@newcommand\uc@check@magicglue{%
463 \ifnum\lastskip=\uc@magic@glue\unskip\else
465 \edef\uc@temp@a{\the\uc@combtoks}%
466 \ifx\uc@temp@a\empty\else
467 \PackageWarning{ucs}{Magic kern expected. Probably some %SPACE
468 non-unicode characters mixed in while option combine was %SPACE
469 in effect.}\fi\endgroup
471 \uc@newcommand\unicodevirtual#1{%
472 \def\uc@temp@a##1{#1}\uc@output{\csname uc@temp@a\endcsname}{"FFFF}}
473 \uc@newcommand\unicodecombine{%
474 \ifx\protect\@typeset@protect
476 %\typeout{WRITING: \the\uc@combtoksb}%
478 \uc@prechar@exec{-1}%
479 \global\uc@combtoksb{}%
480 \ifx\uc@throw\undefined\else
481 \def\uc@got{-1}\uc@throw\global\let\uc@throw\undefined\fi
483 \noexpand\unicodecombine\fi
485 \uc@newcommand\uc@combine#1#2{%
486 \ifx\protect\@typeset@protect
487 \@temptokena\expandafter{#1{}}%
488 \expandafter\expandafter\expandafter\ifx
489 \expandafter\uc@firstofmany\the\@temptokena\uc@firstofmany\uc@cmb
491 \uc@combtoks\expandafter\expandafter\expandafter\expandafter
492 \expandafter\expandafter\expandafter{%
493 \expandafter\expandafter\expandafter\@gobble
494 \expandafter#1\expandafter{\the\uc@combtoks}}%
497 \xdef\uc@comb@code{\number#2}%
498 \global\uc@combtoks\expandafter{#1{}}%
500 %\typeout{->COMBTOKS: \the\uc@combtoks}%
501 \hskip\uc@magic@glue spplus0ptminus0pt %SPACE ; Insert magic glue
503 \noexpand\unichar{\number#2}\fi
505 \uc@newcommand\uc@char@notloaded#1{%
506 \count255=#1\divide\count255 by 256%
507 \edef\uc@temp@a{uni-\number\count255.def}%
508 \expandafter\ifx\csname\uc@temp@a\endcsname\relax\else
509 \uc@secondtry#1\relax\fi
510 \ifnum\uc@secondtry=#1\relax
511 % If the file has already been loaded, but the character is unknown,
512 % output an error and show the replacement glyph
513 \unicode@numtohex\uc@temp@b{#1}4%
514 \expandafter\ifx\csname
515 missing-unicode-warned-\number#1\endcsname\relax
516 \global\expandafter\let\csname
517 missing-unicode-warned-\number#1\endcsname\@ne
518 \unicode@error@unknown\@ne{Unknown Unicode character % SPACE
519 \number#1 \uc@spc= U+\uc@temp@b,\MessageBreak
520 possibly declared in \uc@temp@a.\MessageBreak
521 Type H to see if it is available with options}{#1}%
523 \PackageWarning{ucs}{Unknown character % SPACE
524 \number#1 \uc@spc = 0x\uc@temp@b\uc@spc
526 \unicode@invalid{#1}%
530 \ifUnicodeOptionsavemem
532 \global\expandafter\let\csname\uc@temp@a\endcsname\@ne
536 \expandafter\InputIfFileExists\expandafter{\uc@temp@a}{%
537 \global\let\uni@dataloaded1%
540 % End of local group for inputted file
542 % Retry displaying character. This won't cause infinite recursion,
543 % because we have marked this file as loaded (globally or, if
544 % |savemem| is set, at least here).
545 \uc@secondtry#1\relax%
549 \uc@newcommand\PreloadUnicodePage#1{%
551 \global\expandafter\let\csname uni-#1.def\endcsname\@ne
553 \InputIfFileExists{uni-#1.def}{\let\uni@dataloaded1}{%
554 \PackageError{ucs}{Could not find uni-#1.def}{}}%
556 \uc@newcommand\PrerenderUnicode{%
557 \@ifstar{\@prerenderunicode\unichar}{\@prerenderunicode\@gobble}}%
558 \uc@newcommand\@prerenderunicode#1#2{%
560 \UnicodeCharFilter\@gobble
561 \let#1\@gobble\setbox0\hbox{#2}\endgroup}
562 \uc@newcommand\DeclareUnicodeCharacter#1#2{%
563 \DeclareUnicodeCharacterAsOptional{#1}{document}{#2}}
564 \uc@newcommand\DeclareUnicodeCharacterAsOptional{%
565 \let\uc@temp@a\relax\uni@declcharopt}
566 \uc@newcommand\uc@dclc#1#2{%
567 \let\next=\uni@declcharopt
568 \ifUnicodeOptionsavemem
569 \ifnum\uc@got=#1\else
570 \let\next=\@gobblethree\fi
572 \ifx\next\uni@declcharopt
573 \expandafter\ifx\csname uni@active@#2\endcsname\relax
574 \let\next\@gobblethree\else
575 \expandafter\ifx\csname u-#2-\number#1\endcsname\relax\else
576 \let\next\@gobblethree\fi\fi
577 \let\uc@temp@a\global
580 \uc@newcommand\uni@declcharopt#1#2#3{%
581 %\typeout{Defining: u-#2-\number#1 (\meaning\uc@temp@a)}%
582 \ifx\utf@viii@map\undefined\else
583 \expandafter\utf@viii@map\expandafter{\number#1}\fi
584 \expandafter\uc@temp@a\expandafter\def
585 \csname u-#2-\number#1\endcsname##1{#3}%\fi
586 \expandafter\ifx\csname u-\number#1-h/o\endcsname\relax
587 \expandafter\def\csname u-\number#1-h/o\endcsname{}\fi
588 \expandafter\uc@temp@a\expandafter\edef
589 \csname u-\number#1-h/o\endcsname{%
590 {#2}\csname u-\number#1-h/o\endcsname}%
592 \let\unichar\uni@char
593 \uc@newcommand\unicodesuper#1{\textsuperscript{#1}}%
594 \uc@newcommand\@getcharinfo#1#2{%
596 \countdef\uc@got0\relax\uc@got#2\relax
597 \global\def#1{Character's name unknown}%
598 \def\info##1{\xdef#1{##1}}%
600 \ifUnicodeOptionfasterrors
601 \global\def#1{No further informations known % SPACE
602 because of option fasterrors.}\else
603 {\InputIfFileExists{uninames.dat}{}{%
604 \global\def#1{Character database uninames.dat not found. %SPACE
605 \MessageBreak Character \number#2 \uc@spc unknown}}}%
608 \def\uc@dclc##1##2##3{\ifnum##1=\uc@got
609 \toks255\expandafter{\the\toks255, ##2}\fi}%
610 \count255\uc@got\divide\count255by256\relax
611 %\edef\temp@a{uni-\number\count255.def}%
612 \InputIfFileExists{uni-\number\count255.def}{}{}%
613 \expandafter\ifx\expandafter\@nil\the\toks255 \@nil
614 \xdef#1{#1\noexpand\MessageBreak
615 Character is not defined in uni-*.def files}%
617 \expandafter\expandafter\expandafter\@getcharinfo@
618 \expandafter\expandafter\expandafter#1%
619 \expandafter\expandafter\expandafter
620 {\expandafter#1\expandafter}\the\toks255 \@nil%
623 \def\@getcharinfo@#1#2, #3\@nil{\gdef#1{#2\MessageBreak
624 Character available with following options:\MessageBreak
625 \uc@spc\uc@spc\uc@spc #3}}
626 \uc@newcommand\PrintUnicodeName#1{{%
627 \@getcharinfo{\ci}{#1}%
628 \def\MessageBreak{^^J}%
629 \typeout{^^J\ci^^J}}}
630 \uc@newcommand\UnicodeCharFilter#1{\let\unicode@charfilter=#1}
631 \uc@newcommand\UCSProtectionNone{%
632 \def\ucs@protected@unichar{}%
633 \UnicodeCharFilter\@firstofone}
634 \uc@newcommand\UCSProtectionIeC{%
635 \def\ucs@protected@unichar{}%
636 \UnicodeCharFilter\IeC}
637 \uc@newcommand\UCSProtectionUnichar{%
638 \def\ucs@protected@unichar##1{\ifx\protect\@typeset@protect}%
639 \UnicodeCharFilter\@firstofone}
641 \uc@newcommand\uni@resetcatcodes{%
642 \endlinechar=13\relax
643 \def\reserved@a##1##2{%
649 \ifnum\@tempcnta>\@tempcntb\else
650 \reserved@c\@tempcnta
651 \advance\@tempcnta\@ne
652 \expandafter\reserved@b
667 \catcode`\^^I=10\relax
668 \catcode`\^^J=12\relax
669 \catcode`\^^L=12\relax
670 \catcode`\^^M=5\relax
671 \def\reserved@c##1{\catcode##1=12\relax}%
674 \reserved@a{`\'}{`\?}%
679 \def\reserved@c##1{\catcode##1=11\relax}%
680 \reserved@a{`\A}{`\Z}%
681 \reserved@a{`\a}{`\z}%
682 \def\reserved@c##1{\catcode##1=15\relax}%
683 \reserved@a{0}{`\^^H}%
685 \reserved@a{`\^^N}{31}%
689 \uc@newcommand\unicode@error@unknown{\protect\unicode@error@unknown@}%
690 \uc@newcommand\unicode@error@unknown@#1#2#3{%
691 {\expandafter\countdef\expandafter\uc@got\expandafter0%
692 \expandafter\relax\expandafter\uc@got\number#3\relax
693 \ifx\measuring@false\undefined\else\measuring@false\fi
694 \@getcharinfo\uc@temp@c{#3}%
695 \ifUnicodeOptionwarnunknown
696 \PackageWarning{ucs}{#2\MessageBreak\uc@temp@c.\MessageBreak
697 Enter I\noexpand!<RET> to define the glyph.}%
698 \ifx#1\@ne\unicode@invalid{#3}\fi
700 \let!\unicode@read@definition\catcode`\!13\relax
701 \let\uc@read@definition\undefined
702 \PackageError{ucs}{#2}{\uc@temp@c.\MessageBreak
703 Enter I\noexpand!<RET> to define the glyph.}%
705 \ifx\uc@read@definition\undefined\unicode@invalid{#3}%
706 \else\uc@read@definition\fi\fi
709 \uc@newcommand\unicode@read@definition{%
711 \typein[\definition]{Please enter definition for %SPACE
712 unicode character \number\uc@got}%
713 \global\let\uc@read@definition\definition
714 \toks255\expandafter{\definition}%
715 \edef\definition{\noexpand\DeclareUnicodeCharacter%
716 {\number\uc@got}{\the\toks255}}%
717 \toks255\expandafter{\definition}%
718 \typeout{Tip:\MessageBreak You may include\MessageBreak
719 \uc@spc\uc@spc\the\toks255\MessageBreak
720 into your document source.}%
723 \def\uc@firstofmany#1#2\uc@firstofmany{#1}
724 \ifx\AtBeginDocument\undefined\else
725 \AtBeginDocument{\def\uc@tempa{\@inpenc@undefined@{utf8}}%
726 \ifx\@inpenc@undefined\uc@tempa
727 \ifx\restore@utf@viii@actives\undefined
728 \PackageWarning{ucs}{***************************\MessageBreak You %SPACE
729 seem to have loaded inputencoding utf8\MessageBreak (LaTeX kernel %SPACE
730 UTF-8) instead of utf8x (ucs.sty UTF-8).\MessageBreak Probably you %SPACE
731 are compiling a document written for a\MessageBreak
732 pre-august-2004 ucs.sty.\MessageBreak
733 ***************************\MessageBreak Please use %SPACE
734 \string\usepackage[utf8x]{inputenc} instead of\MessageBreak
735 \string\usepackage[utf8]{inputenc}.\MessageBreak
736 ***************************\MessageBreak If you should really want %SPACE
737 to use ucs.sty and kernel's\MessageBreak utf8.def together, use %SPACE
738 \string\usepackage[utf8x,utf8]{inputenc}\MessageBreak to disable %SPACE
739 compatibility mode\MessageBreak
740 ***************************\MessageBreak Activating compatibility %SPACE
741 mode.\MessageBreak ***************************\MessageBreak}%
742 \global\let\uc@inputencoding\inputencoding
743 \inputencoding{utf8x}%
744 \def\inputencoding#1{%
745 {\def\uc@tempa{#1}\def\uc@tempb{utf8}\ifx\uc@tempa\uc@tempb
746 \aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi}%
747 {\restore@utf@viii@actives}{\uc@inputencoding{#1}}}%