diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ucs/utils/autofe.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ucs/utils/autofe.sty | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ucs/utils/autofe.sty b/Master/texmf-dist/tex/latex/ucs/utils/autofe.sty new file mode 100644 index 00000000000..1145ce17a20 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ucs/utils/autofe.sty @@ -0,0 +1,86 @@ +%% +%% This is file `autofe.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ucs.dtx (with options: `autofe.sty') +%% +%% Copyright 2001 Dominique Unruh <unruh@ut.ee> +%% Copyright 2012 Wolfgang Jeltsch <wolfgang@cs.ioc.ee> +%% +%% This program is provided under the terms of the LaTeX Project Public License with some +%% modifications. See the file LICENSE for information. +%% +\ProvidesPackage{autofe}[2002/12/17 Automatic switching of fontencodings] + +\let\autofe@mode1 + +\let\autofe@DeclareTextCommand\DeclareTextCommand +\def\DeclareTextCommand{\autofe@parse@declaretextcommand\autofe@DeclareTextCommand} +\let\autofe@ProvideTextCommand\ProvideTextCommand +\def\ProvideTextCommand{\autofe@parse@declaretextcommand\autofe@ProvideTextCommand} +\let\autofe@DeclareTextSymbol\DeclareTextSymbol + +\def\autofe@parse@declaretextcommand#1#2#3{% + \@ifnextchar[% + {\autofe@parse@declaretextcommand@a{#1}{#2}{#3}}% + {\autofe@parse@declaretextcommand@dd{#1}{#2}{#3}}} +\def\autofe@parse@declaretextcommand@a#1#2#3[#4]{% + \@ifnextchar[% + {\autofe@parse@declaretextcommand@aa{#1}{#2}{#3}{#4}}% + {\autofe@parse@declaretextcommand@ad{#1}{#2}{#3}{#4}}} + +\def\autofe@parse@declaretextcommand@aa#1#2#3#4[#5]#6{% + %{\toks255{#1{#2}{#3}[#4][#5]{#6}}\typeout{Running \the\toks255}}% + \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{\autofe@ProvideTextCommand{#2}{?}[#4][#5]}{#6}\fi + #1{#2}{#3}[#4][#5]{#6}% +} +\def\autofe@parse@declaretextcommand@ad#1#2#3#4#5{% + %{\toks255{#1{#2}{#3}[#4]{#5}}\typeout{Running \the\toks255}}% + \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{\autofe@ProvideTextCommand{#2}{?}[#4]}{#5}\fi + #1{#2}{#3}[#4]{#5}% +} +\def\autofe@parse@declaretextcommand@dd#1#2#3#4{% + %{\toks255{#1{#2}{#3}{#4}}\typeout{Running \the\toks255}}% + \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#3}{#1{#2}{?}}{#4}\fi + #1{#2}{#3}{#4}% +} +\def\DeclareTextSymbol#1#2#3{% + %{\toks255{\autofe@DeclareTextSymbol{#1}{#2}{#3}}\typeout{Running \the\toks255}}% + \ifx\autofe@mode0\else\expandafter\autofe@defdef\expandafter{#2}{\autofe@ProvideTextCommand{#1}{?}}{\char#3}\fi + \autofe@DeclareTextSymbol{#1}{#2}{#3}% +} + +\def\autofe@defdef#1#2#3{% + \begingroup + \def\temp@a{#1}\def\temp@b{?}% + \ifx\temp@a\temp@b + \let\temp@a\@gobbletwo + \else + \ifx\autofe@mode1% + \let\temp@a\@firstoftwo + \else + \let\temp@a\@secondoftwo + \fi + \fi + \expandafter\endgroup + \temp@a + {#2{{\fontencoding{#1}\selectfont#3}}}% + {#2{\fontencoding{#1}\selectfont#3}}% +} + +\def\autofe@options{} +\def\autofe@add@fe#1{\g@addto@macro\autofe@options{\RequirePackage[#1]{fontenc}}} +\DeclareOption{global}{\g@addto@macro\autofe@options{\let\autofe@mode2}} +\DeclareOption{local}{\g@addto@macro\autofe@options{\let\autofe@mode1}} +\DeclareOption{off}{\g@addto@macro\autofe@options{\let\autofe@mode0}} +\DeclareOption*{\expandafter\autofe@add@fe\expandafter{\CurrentOption}} +\ProcessOptions* + +\typeout{\meaning\autofe@options} +\autofe@options + +\let\autofe@options\undefined +\let\autofe@add@fe\undefined + |