diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/lshort-chinese/src/usefulmacros.sty')
-rw-r--r-- | Master/texmf-dist/doc/latex/lshort-chinese/src/usefulmacros.sty | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/lshort-chinese/src/usefulmacros.sty b/Master/texmf-dist/doc/latex/lshort-chinese/src/usefulmacros.sty new file mode 100644 index 00000000000..79683137ec5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/lshort-chinese/src/usefulmacros.sty @@ -0,0 +1,105 @@ +% usefulmacros.sty +% This file provides several useful LaTeX macros as well as \ifLaTeX@e, +% and \futurenonspacelet. +% Licensed under LPPL. +\catcode`\@=11 +\ifx\@usefulmacros@defined\@undefined +\def\@usefulmacros@defined{\relax} +\def\@usefulmacros@LaTeX@e{LaTeX2e} +\def\ifLaTeX@e{\ifx\fmtname\@usefulmacros@LaTeX@e} +%\ifx\LaTeX\@undefined +\ifLaTeX@e\else +\def\@nnil{\@nil}% +\def\@empty{}% +\def\@fornoop#1\@@#2#3{}% +\long\def\@for#1:=#2\do#3{% + \expandafter\def\expandafter\@fortmp\expandafter{#2}% + \ifx\@fortmp\@empty \else + \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}% +\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else + #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}% +\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}% +\def\@tfor#1:={\@tf@r#1 }% +\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else + \@tforloop#2\@nil\@nil\@@#1{#3}\fi}% +\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}% +\long\def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch} +\def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} +\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token +\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} +% +\long\def\@firstoftwo#1#2{#1} +\long\def\@secondoftwo#1#2{#2} +\expandafter\ifx\csname ifcsname\endcsname\relax +\def\@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\else +\def\@ifundefined#1{% + \unless\ifcsname#1\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\fi +% +\def\@namedef#1{\expandafter\def\csname #1\endcsname} +% +\def\newcount{\alloc@0\count\countdef\insc@unt} +\def\newdimen{\alloc@1\dimen\dimendef\insc@unt} +\def\newskip{\alloc@2\skip\skipdef\insc@unt} +\def\newmuskip{\alloc@3\muskip\muskipdef\@cclvi} +\def\newbox{\alloc@4\box\chardef\insc@unt} +\def\newtoks{\alloc@5\toks\toksdef\@cclvi} +\def\newread{\alloc@6\read\chardef\sixt@@n} +\def\newwrite{\alloc@7\write\chardef\sixt@@n} +\fi % end if + +\def\@BTcs{} +\let\nexttoken\relax +\let\next\relax +\def\futurenonspacelet#1{\def\@BTcs{#1}% + \afterassignment\@BTfnslone\let\nexttoken= } +\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo} +\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree + \else\let\next=\nexttoken\fi \next} +\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= } + +\ifx\fbox\@undefined +\newbox\fbox@tmpbox +\newdimen\fbox@linewidth +\newdimen\fbox@tmpdim +\fbox@linewidth=0.4pt +\long\def\fbox#1{% + \setbox\fbox@tmpbox=\hbox{#1}% + \fbox@tmpdim=2\fbox@linewidth + \advance\fbox@tmpdim\wd\fbox@tmpbox + \leavevmode\hbox{\vbox{\hrule height \fbox@linewidth width \fbox@tmpdim + \hbox{\vrule width \fbox@linewidth height \ht\fbox@tmpbox + #1\vrule width \fbox@linewidth height \ht\fbox@tmpbox}% + \hrule height \fbox@linewidth width \fbox@tmpdim + }}% +} +\fi +\fi |