diff options
author | Karl Berry <karl@freefriends.org> | 2011-04-12 22:56:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-04-12 22:56:39 +0000 |
commit | 3c9b5c2960ae2455180bdb3a4e67bf10175b39af (patch) | |
tree | 53ac9731c23e82f60349ec920ed8d816738913dc /Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |
parent | f437333cf5d63d69f5ab9fd1eb553af4175037d0 (diff) |
oberdiek (12apr11)
git-svn-id: svn://tug.org/texlive/trunk@22061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | 298 |
1 files changed, 246 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty b/Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty index 6df197f2554..156908c07c2 100644 --- a/Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +++ b/Master/texmf-dist/tex/generic/oberdiek/ltxcmds.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2009, 2010 by +%% Copyright (C) 2009-2011 by %% Heiko Oberdiek <heiko.oberdiek at googlemail.com> %% %% This work may be distributed and/or modified under the @@ -31,16 +31,22 @@ %% This work consists of the main source file ltxcmds.dtx %% and the derived files %% ltxcmds.sty, ltxcmds.pdf, ltxcmds.ins, ltxcmds.drv, -%% ltxcmds-test1.tex, ltxcmds-test-gobble.tex. +%% ltxcmds-test1.tex, ltxcmds-test-gobble.tex, +%% ltxcmds-test-ifempty.tex, ltxcmds-test-zapspace.tex, +%% ltxcmds-test-ifboxempty.tex. %% -\begingroup - \catcode44 12 % , - \catcode45 12 % - - \catcode46 12 % . - \catcode58 12 % : - \catcode64 11 % @ - \catcode123 1 % { - \catcode125 2 % } +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode35=6 % # + \catcode39=12 % ' + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=12 % : + \catcode64=11 % @ + \catcode123=1 % { + \catcode125=2 % } \expandafter\let\expandafter\x\csname ver@ltxcmds.sty\endcsname \ifx\x\relax % plain-TeX, first loading \else @@ -48,7 +54,6 @@ \ifx\x\empty % LaTeX, first loading, % variable is initialized, but \ProvidesPackage not yet seen \else - \catcode35 6 % # \expandafter\ifx\csname PackageInfo\endcsname\relax \def\x#1#2{% \immediate\write-1{Package #1 Info: #2.}% @@ -60,21 +65,24 @@ \aftergroup\endinput \fi \fi -\endgroup -\begingroup - \catcode35 6 % # - \catcode40 12 % ( - \catcode41 12 % ) - \catcode44 12 % , - \catcode45 12 % - - \catcode46 12 % . - \catcode47 12 % / - \catcode58 12 % : - \catcode64 11 % @ - \catcode91 12 % [ - \catcode93 12 % ] - \catcode123 1 % { - \catcode125 2 % } +\endgroup% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode35=6 % # + \catcode39=12 % ' + \catcode40=12 % ( + \catcode41=12 % ) + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode47=12 % / + \catcode58=12 % : + \catcode64=11 % @ + \catcode91=12 % [ + \catcode93=12 % ] + \catcode123=1 % { + \catcode125=2 % } \expandafter\ifx\csname ProvidesPackage\endcsname\relax \def\x#1#2#3[#4]{\endgroup \immediate\write-1{Package: #3 #4}% @@ -93,48 +101,62 @@ \fi \expandafter\x\csname ver@ltxcmds.sty\endcsname \ProvidesPackage{ltxcmds}% - [2010/04/26 v1.7 LaTeX kernel commands for general use (HO)] -\begingroup - \catcode123 1 % { - \catcode125 2 % } + [2011/03/16 v1.18 LaTeX kernel commands for general use (HO)]% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode64=11 % @ \def\x{\endgroup \expandafter\edef\csname LTXcmds@AtEnd\endcsname{% - \catcode35 \the\catcode35\relax - \catcode64 \the\catcode64\relax - \catcode123 \the\catcode123\relax - \catcode125 \the\catcode125\relax + \endlinechar=\the\endlinechar\relax + \catcode13=\the\catcode13\relax + \catcode32=\the\catcode32\relax + \catcode35=\the\catcode35\relax + \catcode61=\the\catcode61\relax + \catcode64=\the\catcode64\relax + \catcode123=\the\catcode123\relax + \catcode125=\the\catcode125\relax }% }% -\x -\catcode35 6 % # -\catcode64 11 % @ -\catcode123 1 % { -\catcode125 2 % } +\x\catcode61\catcode48\catcode32=10\relax% +\catcode13=5 % ^^M +\endlinechar=13 % +\catcode35=6 % # +\catcode64=11 % @ +\catcode123=1 % { +\catcode125=2 % } \def\TMP@EnsureCode#1#2{% \edef\LTXcmds@AtEnd{% \LTXcmds@AtEnd - \catcode#1 \the\catcode#1\relax + \catcode#1=\the\catcode#1\relax }% - \catcode#1 #2\relax + \catcode#1=#2\relax } +\TMP@EnsureCode{36}{3}% $ +\TMP@EnsureCode{38}{4}% & \TMP@EnsureCode{40}{12}% ( \TMP@EnsureCode{41}{12}% ) \TMP@EnsureCode{45}{12}% - \TMP@EnsureCode{46}{12}% . \TMP@EnsureCode{47}{12}% / \TMP@EnsureCode{60}{12}% < -\TMP@EnsureCode{61}{12}% = \TMP@EnsureCode{62}{12}% > \TMP@EnsureCode{91}{12}% [ \TMP@EnsureCode{96}{12}% ` \TMP@EnsureCode{93}{12}% ] \TMP@EnsureCode{94}{12}% ^ (superscript) (!) \TMP@EnsureCode{124}{12}% | +\edef\LTXcmds@AtEnd{\LTXcmds@AtEnd\noexpand\endinput} \chardef\ltx@zero=0 % \chardef\ltx@one=1 % \chardef\ltx@two=2 % \chardef\ltx@active=13 % \chardef\ltx@cclv=255 % +\def\ltx@minusone{% + -\ltx@one +} \long\def\ltx@gobble#1{} \long\def\ltx@gobbletwo#1#2{} \long\def\ltx@gobblethree#1#2#3{} @@ -143,8 +165,7 @@ \romannumeral \csname ltx@zero% \expandafter\LTXcmds@GobbleNum - \romannumeral\expandafter\ltx@firstofone - \expandafter{\LTXcmds@num#1}000{m\endcsname}% + \romannumeral\LTXcmds@num{#1}000{m\endcsname}% } \def\LTXcmds@GobbleNum#1{% \csname LTXcmds@G#1\LTXcmds@GobbleNum @@ -155,6 +176,13 @@ \long\def\ltx@firstofone#1{#1} \long\def\ltx@firstoftwo#1#2{#1} \long\def\ltx@secondoftwo#1#2{#2} +\long\def\ltx@firstofthree#1#2#3{#1} +\long\def\ltx@secondofthree#1#2#3{#2} +\long\def\ltx@thirdofthree#1#2#3{#3}% +\long\def\ltx@firstoffour#1#2#3#4{#1} +\long\def\ltx@secondoffour#1#2#3#4{#2} +\long\def\ltx@thirdoffour#1#2#3#4{#3}% +\long\def\ltx@fourthoffour#1#2#3#4{#4}% \long\def\ltx@car#1#2\@nil{#1} \long\def\ltx@cdr#1#2\@nil{#2} \long\def\ltx@carzero#1\@nil{}% @@ -170,8 +198,7 @@ \romannumeral \csname LTXcmds@CarNumFinish% \expandafter\LTXcmds@CarNum - \romannumeral\expandafter\ltx@firstofone - \expandafter{\LTXcmds@num#1}000{x\endcsname}% + \romannumeral\LTXcmds@num{#1}000{x\endcsname}% } \def\LTXcmds@CarNum#1{% \csname LTXcmds@C#1\LTXcmds@CarNum @@ -211,6 +238,16 @@ \lowercase{\endgroup \def\ltx@hashchar{0}% } +\begingroup + \lccode`0=`\{\relax +\lowercase{\endgroup + \def\ltx@leftbracechar{0}% +} +\begingroup + \lccode`0=`\}\relax +\lowercase{\endgroup + \def\ltx@rightbracechar{0}% +} \def\ltx@newif#1{% \begingroup \escapechar=-1 % @@ -233,6 +270,29 @@ }% \csname#1false\endcsname } +\def\ltx@newglobalif#1{% + \begingroup + \escapechar=-1 % + \expandafter\endgroup + \expandafter\LTXcmds@newglobalif\string#1\@nil +} +\begingroup + \escapechar=-1 % +\expandafter\endgroup +\expandafter +\def\expandafter\LTXcmds@newglobalif\string\if#1\@nil{% + \expandafter\edef\csname#1true\endcsname{% + \global\let + \expandafter\noexpand\csname if#1\endcsname + \noexpand\iftrue + }% + \expandafter\edef\csname#1false\endcsname{% + \global\let + \expandafter\noexpand\csname if#1\endcsname + \noexpand\iffalse + }% + \csname#1false\endcsname +} \def\ltx@LocalExpandAfter{% \begingroup \expandafter\expandafter\expandafter @@ -278,6 +338,12 @@ \def\ltx@StripPrefix{% \expandafter\ltx@RemovePrefix } +\def\ltx@onelevel@sanitize#1{% + \edef#1{% + \expandafter + \ltx@RemovePrefix\meaning#1% + }% +} \def\ltx@clsextension{cls} \def\ltx@pkgextension{sty} \def\ltx@iffileloaded#1{% @@ -322,7 +388,7 @@ \fi } \def\ltx@ifclasslater#1{% - \ltx@ifclasslater{#1.\ltx@clsextension}% + \ltx@iffilelater{#1.\ltx@clsextension}% } \def\ltx@ifpackagelater#1{% \ltx@iffilelater{#1.\ltx@pkgextension}% @@ -350,7 +416,7 @@ \fi }% } -\def\ltx@GlobalAppendToMacro#1#2{% +\long\def\ltx@GlobalAppendToMacro#1#2{% \ifx\ltx@undefined#1% \let#1\ltx@empty \else @@ -363,7 +429,7 @@ \xdef#1{\the\toks0}% \endgroup } -\def\ltx@LocalAppendToMacro#1#2{% +\long\def\ltx@LocalAppendToMacro#1#2{% \global\let\LTXcmds@gtemp#1% \ifx\ltx@undefined\LTXcmds@gtemp \global\let\LTXcmds@gtemp\ltx@empty @@ -447,11 +513,139 @@ \hbox } \ltx@IfUndefined{numexpr}{% - \let\LTXcmds@num\number + \def\LTXcmds@num#1{% + \expandafter\ltx@firstofone\expandafter{% + \number#1% + }% + }% +}{% + \def\LTXcmds@num#1{% + \expandafter\ltx@firstofone\expandafter{% + \the\numexpr#1% + }% + }% +} +\ltx@IfUndefined{detokenize}{% + \def\LTXcmds@temp#1{% + \long\def\ltx@ifempty##1{% + \romannumeral0% + \iffalse{\fi + \expandafter\ltx@gobble\expandafter{% + \expandafter{\string##1}% + \expandafter\ltx@gobble\string + }% + \expandafter\ltx@firstofthree\expandafter + {\iffalse}\fi + \expandafter#1\ltx@secondoftwo + }% + \expandafter#1\ltx@firstoftwo + }% + \long\def\ltx@ifblank##1{% + \romannumeral0% + \iffalse{\fi + \expandafter\expandafter\expandafter\ltx@gobble + \expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter{% + \expandafter\string\ltx@gobble##1.% + }% + \expandafter\ltx@gobble\string + }% + \expandafter\ltx@firstofthree\expandafter + {\iffalse}\fi + \expandafter#1\ltx@secondoftwo + }% + \expandafter#1\ltx@firstoftwo + }% + }% + \LTXcmds@temp{ }% +}{% + \long\def\ltx@ifempty#1{% + \romannumeral% + \csname + LTXcmds@ifempty% + \ifcat$\detokenize{#1}$% + @% + \fi + \endcsname + }% + \long\def\LTXcmds@ifempty@#1#2{0 #1}% + \long\def\LTXcmds@ifempty#1#2{0 #2}% + \long\def\ltx@ifblank#1{% + \romannumeral% + \csname + LTXcmds@ifempty% + \ifcat$\detokenize\expandafter{\ltx@gobble#1.}$% + @% + \fi + \endcsname + }% +} +\long\def\ltx@zapspace#1{% + \romannumeral + \LTXcmds@zapspace\ltx@zero#1 \@nil +} +\long\def\LTXcmds@zapspace#1 #2\@nil{% + \ltx@ifempty{#2}{% + #1% + }{% + \LTXcmds@zapspace#1#2\@nil + }% +} +\ltx@IfUndefined{lastnodetype}{% + \catcode`\$=9 % + \catcode`\&=14 % }{% - \let\LTXcmds@num\numexpr + \catcode`\$=14 % + \catcode`\&=9 % } -\LTXcmds@AtEnd +\def\ltx@IfBoxEmpty#1{% + \ifvoid#1\relax + \expandafter\ltx@secondoftwo + \else +& \begingroup +& \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{% +& \ifhmode\unhcopy\else\unvcopy\fi#1\relax +& \expandafter +& }% +& \expandafter\endgroup +& \ifnum\lastnodetype<\ltx@zero +& \expandafter\expandafter\expandafter\ltx@firstoftwo +& \else +& \expandafter\expandafter\expandafter\ltx@secondoftwo +& \fi +$ \begingroup +$ \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{% +$ \penalty\ltx@one +$ \ifhmode\unhcopy\else\unvcopy\fi#1\relax +$ \expandafter +$ }% +$ \ifnum\lastpenalty=\ltx@one +$ \endgroup +$ \begingroup +$ \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{% +$ \penalty\ltx@two +$ \ifhmode\unhcopy\else\unvcopy\fi#1\relax +$ \expandafter +$ }% +$ \ifnum\lastpenalty=\ltx@two +$ \def\next{\endgroup\expandafter\ltx@firstoftwo}% +$ \else +$ \def\next{\endgroup\expandafter\ltx@secondoftwo}% +$ \fi +$ \else +$ \def\next{\endgroup\expandafter\ltx@secondoftwo}% +$ \fi +$ \next + \fi +} +\def\ltx@IfBoxVoidOrEmpty#1{% + \ifvoid#1\relax + \expandafter\ltx@thirdoffour + \fi + \ltx@IfBoxEmpty{#1}% +} +\LTXcmds@AtEnd% + \endinput %% %% End of file `ltxcmds.sty'. |