]> matita.cs.unibo.it Git - helm.git/blob - helm/software/share/texmf/unicode/contrib/autofe.sty
Preparing for 0.5.9 release.
[helm.git] / helm / software / share / texmf / unicode / contrib / autofe.sty
1 %%
2 %% This is file `autofe.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% ucs.dtx  (with options: `autofe.sty')
8 %% 
9 %% Copyright 2001 Dominique Unruh <dominique@unruh.de>
10 %% 
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)
14 %% for information.
15 %% 
16 \ProvidesPackage{autofe}[2002/12/17 Automatic switching of fontencodings]
17
18 \let\autofe@mode1
19
20 \let\autofe@DeclareTextCommand\DeclareTextCommand
21 \def\DeclareTextCommand{\autofe@parse@declaretextcommand\autofe@DeclareTextCommand}
22 \let\autofe@ProvideTextCommand\ProvideTextCommand
23 \def\ProvideTextCommand{\autofe@parse@declaretextcommand\autofe@ProvideTextCommand}
24 \let\autofe@DeclareTextSymbol\DeclareTextSymbol
25
26 \def\autofe@parse@declaretextcommand#1#2#3{%
27   \@ifnextchar[%
28   {\autofe@parse@declaretextcommand@a{#1}{#2}{#3}}%
29   {\autofe@parse@declaretextcommand@dd{#1}{#2}{#3}}}
30 \def\autofe@parse@declaretextcommand@a#1#2#3[#4]{%
31   \@ifnextchar[%
32   {\autofe@parse@declaretextcommand@aa{#1}{#2}{#3}{#4}}%
33   {\autofe@parse@declaretextcommand@ad{#1}{#2}{#3}{#4}}}
34
35 \def\autofe@parse@declaretextcommand@aa#1#2#3#4[#5]#6{%
36   %{\toks255{#1{#2}{#3}[#4][#5]{#6}}\typeout{Running \the\toks255}}%
37   \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{\autofe@ProvideTextCommand{#2}{?}[#4][#5]}{#6}\fi
38   #1{#2}{#3}[#4][#5]{#6}%
39 }
40 \def\autofe@parse@declaretextcommand@ad#1#2#3#4#5{%
41   %{\toks255{#1{#2}{#3}[#4]{#5}}\typeout{Running \the\toks255}}%
42   \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{\autofe@ProvideTextCommand{#2}{?}[#4]}{#5}\fi
43   #1{#2}{#3}[#4]{#5}%
44 }
45 \def\autofe@parse@declaretextcommand@dd#1#2#3#4{%
46   %{\toks255{#1{#2}{#3}{#4}}\typeout{Running \the\toks255}}%
47   \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{#1{#2}{?}}{#4}\fi
48   #1{#2}{#3}{#4}%
49 }
50 \def\DeclareTextSymbol#1#2#3{%
51   %{\toks255{\autofe@DeclareTextSymbol{#1}{#2}{#3}}\typeout{Running \the\toks255}}%
52   \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#2}{\autofe@ProvideTextCommand{#1}{?}}{\char#3}\fi
53   \autofe@DeclareTextSymbol{#1}{#2}{#3}%
54 }
55
56 \def\autofe@defdef#1#2#3{%
57   \begingroup
58     \def\temp@a{#1}\def\temp@b{?}%
59     \ifx\temp@a\temp@b
60       \let\temp@a\@gobbletwo
61     \else
62       \ifx\autofe@mode1%
63         \let\temp@a\@firstoftwo
64       \else
65         \let\temp@a\@secondoftwo
66       \fi
67     \fi
68   \expandafter\endgroup
69   \temp@a
70   {#2{{\fontencoding{#1}\selectfont#3}}}%
71   {#2{\fontencoding{#1}\selectfont#3}}%
72 }
73
74 \def\autofe@options{}
75 \def\autofe@add@fe#1{\g@addto@macro\autofe@options{\RequirePackage[#1]{fontenc}}}
76 \DeclareOption{global}{\g@addto@macro\autofe@options{\let\autofe@mode2}}
77 \DeclareOption{local}{\g@addto@macro\autofe@options{\let\autofe@mode1}}
78 \DeclareOption{off}{\g@addto@macro\autofe@options{\let\autofe@mode0}}
79 \DeclareOption*{\expandafter\autofe@add@fe\expandafter{\CurrentOption}}
80 \ProcessOptions*
81
82 \typeout{\meaning\autofe@options}
83 \autofe@options
84
85 \let\autofe@options\undefined
86 \let\autofe@add@fe\undefined
87