From 05a46ca1f7bede5c9e2b7ee6e06c545a91589b53 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 20 Nov 2007 07:34:58 +0000 Subject: update gmutils (07-11-20) git-svn-id: svn://tug.org/texlive/trunk@5521 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gmutils/gmutils.sty | 1235 +++++++++++++++++++---- 1 file changed, 1031 insertions(+), 204 deletions(-) (limited to 'Master/texmf-dist/tex/latex/gmutils') diff --git a/Master/texmf-dist/tex/latex/gmutils/gmutils.sty b/Master/texmf-dist/tex/latex/gmutils/gmutils.sty index 4732dc42dfe..8793dbcf664 100644 --- a/Master/texmf-dist/tex/latex/gmutils/gmutils.sty +++ b/Master/texmf-dist/tex/latex/gmutils/gmutils.sty @@ -42,11 +42,13 @@ % \chschange{v0.77}{07/4/14}{1547} % \chschange{v0.78}{07/4/26}{1685} % \chschange{v0.80}{2007/4/29}{1689} +% \chschange{v0.84}{2007/11/13}{2684} +% \chschange{v0.85}{2007/11/16}{2795} % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmutils} - [2007/04/28 v0.80 some rather TeXnical macros, some of them tricky (GM)] + [2007/11/16 v0.85 some rather TeXnical macros, some of them tricky (GM)] % % \tableofcontents @@ -65,11 +67,12 @@ % For details just read the code part. % % \begin{gmlonely} -% \subdivision{Installation} -% -% Just put the \pk{gmutils.sty} somewhere in the \file{texmf/\:tex/\:latex} -% branch. Creating a~\file{texmf/\:tex/\:latex/\:gm} directory may be advisable -% if you consider using other packages written by me. +% \subdivision{Installation} Unpack the \file{gmutils-tds.zip} +% archive (this is an archive that conforms the \acro{TDS} standard, +% see \file{CTAN/tds/tds.pdf}) in some texmf directory or just put +% the \pk{gmutils.sty} somewhere in the \file{texmf/\:tex/\:latex} +% branch. Creating a~\file{texmf/\:tex/\:latex/\:gm} directory may +% be advisable if you consider using other packages written by me. % % Then you should refresh your \TeX\ distribution's files' database % most probably. @@ -78,12 +81,13 @@ % \subdivision{Contents of the \pk{gmutils.zip} Archive} % % The distribution of the \pk{gmutils} package consists of the -% following four files. +% following four files and a~\acro{TDS}-compliant archive. % \begin{verse} % \pk{gmutils.sty}\\ % \pk{README}\\ % \pk{gmutilsDoc.tex}\\ -% \pk{gmutilsDoc.pdf} +% \pk{gmutilsDoc.pdf}\\ +% \pk{gmutils.tds.zip} % \end{verse} % % \begin{gmlonely} @@ -116,7 +120,7 @@ % % % \division{A~couple of abbreviations} -% \CodeDefine\@xa \CodeDefine\@nx +% \Define\@xa \Define\@nx \let\@xa\expandafter \let\@nx\noexpand @@ -128,7 +132,7 @@ % writing so I~make it a~macro. It's an almost verbatim copy of % \LaTeX's |\newif| modulo the letter $g$ and the |\global| prefix. % (File d: \file{ltdefns.dtx} Date: 2004/02/20 Version v1.3g, lines -% 139--150) \CodeDefine\newgif +% 139--150) \Define\newgif \def\newgif#1{% {\escapechar\m@ne \global\let#1\iffalse @@ -139,7 +143,7 @@ % |\global| assignments, we don't have to bother with storing and % restoring the value of |\escapechar|: we can do all the work inside % a~group. -% \CodeDefIndex\@gif +% \DefIndex\@gif \def\@gif#1#2{% \@xa\gdef\csname\@xa\@gobbletwo\string#1% g% the letter $g$ for `|\global|'. @@ -157,7 +161,7 @@ % Note that it's just a~shorthand. |\global\if|\|true/false| % \emph{does} work as expected. -% \CodeDefine\grefstepcounter +% \Define\grefstepcounter % \changes{v0.59}{06/09/04}{moved here from \pk{gmdoc}.} % There's a~trouble with |\refstepcounter|: defining |\@currentlabel| % is local. So let's |\def| a~|\global| version of |\refstepcounter|. @@ -176,7 +180,7 @@ % \dekmedskip % % Another shorthand. It may decrease a~number of |\expandafter|s e.g. -% \CodeDefine\glet +% \Define\glet \def\glet{\global\let} @@ -184,36 +188,40 @@ % second argument to the current definition of its first argument % (works iff the first argument is a~no argument macro). But I~needed % it some times in a~document, where |@| is not a~letter. So: -% \CodeDefine\gaddtomacro +% \Define\gaddtomacro \let\gaddtomacro=\g@addto@macro % The redefining of the first argument of the above macro(s) is % |\global|. What if we want it local? Here we are: -% \CodeDefine\addto@macro +% \Define\addto@macro \long\def\addto@macro#1#2{% \toks@\@xa{#1#2}% \edef#1{\the\toks@}% }%(|\toks@| is a~scratch register, namely |\toks0|.) % And for use in the very document, -% \CodeDefine\addtomacro +% \Define\addtomacro \let\addtomacro=\addto@macro -%\CodeDefine\@emptify \CodeDefine\emptify +% \Define\addtotoks +\long\def\addtotoks#1#2{% + #1=\@xa{\the#1#2}} + +%\Define\@emptify \Define\emptify \newcommand*\@emptify[1]{\let#1=\@empty} \@ifdefinable\emptify{\let\emptify\@emptify} % Note the two following commands are in fact one-argument. -%\CodeDefine\g@emptify \CodeDefine\gemptify +%\Define\g@emptify \Define\gemptify \newcommand*\g@emptify{\global\@emptify} \@ifdefinable\gemptify{\let\gemptify\g@emptify} -% \CodeDefine\@relaxen \CodeDefine\relaxen +% \Define\@relaxen \Define\relaxen \newcommand*\@relaxen[1]{\let#1=\relax} \@ifdefinable\relaxen{\let\relaxen\@relaxen} % Note the two following commands are in fact one-argument. -% \CodeDefine\g@relaxen \CodeDefine\grelaxen +% \Define\g@relaxen \Define\grelaxen \newcommand*\g@relaxen{\global\@relaxen} \@ifdefinable\grelaxen{\let\grelaxen\g@relaxen} @@ -223,11 +231,11 @@ % usually too little: usually it needed setting |\showboxdepth| and % |\showboxbreadth| to some positive values. So, % -% \CodeDefine\gmshowlists +% \Define\gmshowlists % \changes{v0.59}{06/09/04}{moved here from \pk{gmdoc}} \def\gmshowlists{\showboxdepth=1000 \showboxbreadth=1000 \showlists} -% \CodeDefine\nameshow +% \Define\nameshow \newcommand*\nameshow[1]{\@xa\show\csname#1\endcsname} @@ -235,11 +243,11 @@ % for the space, for which it returns | |$_{10}$. In \pk{gmdoc} % I~needed the spaces in macros' and environments' names to be always % \catother, so I~define -% \CodeDefine\xiistring +% \Define\xiistring % \changes{v0.59}{06/09/04}{moved here from \pk{gmdoc}} \def\xiistring#1{% - \if\@nx#1\twelvespace - \twelvespace + \if\@nx#1\xiispace + \xiispace \else \string#1% \fi} @@ -247,7 +255,7 @@ % \division{\cs{@ifnextcat}, \cs{@ifnextac}} % -% As you guess, we |\def| |\@ifnextcat| \`a~la |\@ifnextchar|, see +% As you guess, we |\def| |\@ifnextcat| \agrave~la |\@ifnextchar|, see % \LaTeXe\ source dated 2003/12/01, file d, lines 253--271. The % difference is in the kind of test used: while |\@ifnextchar| does % |\ifx|, |\@ifnextcat| does |\ifcat| which means it looks not at the @@ -258,16 +266,17 @@ % not protected and therefore it shall be expanded if it's % a~macro. Because an assignment is involved, you can't test whether % the next token is an active char. -%\CodeDefine\@ifnextcat + +\long\def\@ifnextcat#1#2#3{% % \changes{v0.75}{2007/01/01}{\cs{let} for \cs[\#]1 changed to % \cs{def} to allow things like \cs{noexpand\*}} -\long\def\@ifnextcat#1#2#3{% +% \HideDef \def\reserved@d{#1}% \def\reserved@a{#2}% \def\reserved@b{#3}% \futurelet\@let@token\@ifncat} -% \CodeDefIndex\@ifncat +% \ResumeDef \def\@ifncat{% \ifx\@let@token\@sptoken \let\reserved@c\@xifncat @@ -282,11 +291,45 @@ {\def\:{\let\@sptoken= } \: % this makes |\@sptoken| a space token. - % \CodeDefIndex\@xifncat + % \DefIndex\@xifncat \def\:{\@xifncat} \@xa\gdef\: {\futurelet\@let@token\@ifncat}} % Note the trick to get a~macro with no parameter and requiring % a~space after it. We do it inside a~group not to spoil the general % meaning of |\:| (which we extend later). +% \dekmedskip +% +% \stanza The next command provides the real \cs{if} test for the next +% token. \emph{It} should be called |\@ifnextchar| but that name is +% assigned for the future \cs{ifx} text, as we know. Therefore we call +% it \cs{@ifnextif}. + +\long\def\@ifnextif#1#2#3{% +% \changes{v0.75}{2007/01/01}{\cs{let} for \cs[\#]1 changed to +% \cs{def} to allow things like \cs{noexpand\*}} +% \HideDef + \def\reserved@d{#1}% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnif} +% \ResumeDef + +\def\@ifnif{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnif + \else + \if\reserved@d\@nx\@let@token + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} + +% \UnDef +{\def\:{\let\@sptoken= } \: % this makes |\@sptoken| a space token. +% \UnDef +\def\:{\@xifnif} \@xa\gdef\: {\futurelet\@let@token\@ifnif}} + % \dekmedskip % % But how to peek at the next token to check whether it's an active @@ -294,7 +337,7 @@ % opener. We do that to avoid taking a~whole |{...}| as the argument % of the next macro, that doesn't use |\futurelet| but takes the next % token as an argument, tests it and puts back intact. -% \CodeDefine\@ifnextac +% \Define\@ifnextac % \changes{v0.75}{2007/01/11}{added} % \long\def\@ifnextac#1#2{% @@ -313,13 +356,13 @@ % a~space. The assignment needs a~little trick (\TeXbook\ appendix D) % since |\let|'s syntax includes one optional space after |=|. % -\let\@tempa\*% +\let\gmu@reserveda\*% \def\*{% - \let\*\@tempa + \let\*\gmu@reserveda \let\gm@letspace= }% \* % -% \CodeDefine\@ifnextspace +% \Define\@ifnextspace \def\@ifnextspace#1#2{% \let\@reserveda\*% \def\*{% @@ -329,7 +372,8 @@ \fi}% \futurelet\@let@token\*} % First use of this macro is for an active |-| that expands to |---| -% if followed by a~space. +% if followed by a~space. Another to make dot checking whether is +% followed by |~| without gobbling the space if it occurs instead. % \division{\cs{afterfi} and Pals} @@ -354,8 +398,8 @@ % |^^M|\catother. To avoid pollution write % \[|\if..\afterfi{\bgroup\@makeother\^^M\egroup}\fi|\,.\] % -% \CodeDefine\afterfi \CodeDefine\afterfifi -% \CodeDefine\afteriffifi +% \Define\afterfi \Define\afterfifi +% \Define\afteriffifi \long\def\afterfi#1#2\fi{\fi#1} % And two more of that family: @@ -395,7 +439,7 @@ % \begingroup\@endpefalse\reserved@a} %\end{verbatim} % -% \CodeDefine\@begnamedgroup +% \Define\@begnamedgroup \@ifdefinable\@begnamedgroup{\relax} \def\@begnamedgroup#1{% \@ignorefalse% not to ignore blanks after group @@ -408,17 +452,17 @@ % will act as |\relax|.) % For back compatibility with my earlier works -% \CodeDefine\bnamegroup -% \CodeDefine\enamegroup +% \Define\bnamegroup +% \Define\enamegroup \let\bnamegroup\@begnamedgroup % And for the ending \def\enamegroup#1{\end{#1}} % And we make it the starred version of |\begin|. % \begin{DoIndex}{\begin} -% \CodeDefine\old@begin \CodeDefine\begin +% \Define\old@begin \Define\begin \let\old@begin\begin - % \CodeDefine*\begin* + % \Define*\begin* \def\begin{\@ifstar{\@begnamedgroup}{\old@begin}} % \end{DoIndex} @@ -476,7 +520,7 @@ % (Since |\DeclareRobustCommand| % doesn't issue an error if its argument has been defined and it only % informs about redefining, loading \pk{relsize} remains allowed.) -% \CodeDefine\relsize +% \Define\relsize \DeclareRobustCommand*\relsize[1]{% \ifmmode \@nomath\relsize\else \begingroup @@ -504,18 +548,18 @@ \rs@size@warning{large}{\string\Huge}\Huge \fi\fi}% end of |\relsize|. -% \CodeDefine\rs@size@warning +% \Define\rs@size@warning \providecommand*\rs@size@warning[2]{\PackageWarning{gmutils (relsize)}{% Size requested is too #1.\MessageBreak Using #2 instead}} -% \CodeDefine\rs@unknown@warning +% \Define\rs@unknown@warning \providecommand*\rs@unknown@warning{\PackageWarning{gmutils (relsize)}{Current font size is unknown! (Why?!?)\MessageBreak Assuming \string\normalsize}} % And a~handful of shorthands: % -% \CodeDefine\larger \CodeDefine\smaller \CodeDefine\textlarger -% \CodeDefine\textsmaller \CodeDefine\largerr \CodeDefine\smallerr +% \Define\larger \Define\smaller \Define\textlarger +% \Define\textsmaller \Define\largerr \Define\smallerr \DeclareRobustCommand*\larger[1][\@ne]{\relsize{+#1}} \DeclareRobustCommand*\smaller[1][\@ne]{\relsize{-#1}} \DeclareRobustCommand*\textlarger[2][\@ne]{{\relsize{+#1}#2}} @@ -532,66 +576,71 @@ % Just see the below usage of this macro `with \TeX's eyes', as my % \TeX\ Guru taught me. % -% \CodeDefine\firstofone \long\def\firstofone#1{#1} +% The next command, |\foone|, is intended as two-argument for +% shortening of the |\bgroup...\firstofone{\egroup...}| hack. +% +\long\def\foone#1{\bgroup#1\egroupfirstofone} +% \UnDef +\long\def\egroupfirstofone#1{\egroup#1} + +\long\def\fooatletter{\foone\makeatletter} + + + % And this one is defined, I~know, but it's not |\long| with the % standard definition. -% \CodeDefine\gobble\CodeDefine\gobbletwo +% \Define\gobbletwo \long\def\gobble#1{} \let\gobbletwo\@gobbletwo -% \CodeDefine\subs -\bgroup\catcode`\_=8 % -\firstofone{\egroup - \let\subs=_} +% \Define\subs +\foone{\catcode`\_=8 }% +{\let\subs=_} + +\foone{\@makeother\_}% +{\def\xiiunder{_}} + +\@ifundefined{XeTeXversion}{}{% + \def\xiiunder{\char"005F }% + \let\_\xiiunder} -% \CodeDefine\twelveunder -\bgroup\@makeother\_% -\firstofone{\egroup - \def\twelveunder{_}} % Now, let's define such a~smart |_| (underscore) which will be usual % |_|${}_8$ in the math mode and |_|\catother\ (`other') outside math. -% \CodeDefine\smartunder -% \changes{v0.60}{06/09/05}{\cs{\_} instead of \cs{twelveunder}} -\bgroup\catcode`\_=\active -\firstofone{\egroup +% \Define\smartunder +% \changes{v0.60}{06/09/05}{\cs{\_} instead of \cs{xiiunder}} +\foone{\catcode`\_=\active} +{% \newcommand*\smartunder{% \catcode`\_=\active \def_{\ifmmode\subs\else\_\fi}}}% We define it as |\_| not just as -% |\twelveunder| because some font encodings don't have |_| at the +% |\xiiunder| because some font encodings don't have |_| at the % |\char`\_| position. % % \CodeEscapeChar\! -% \CodeDefine\bslash \CodeDefine\twelvebackslash -\begingroup\catcode`\!=0 -\@makeother\\ -!firstofone{!endgroup% - !newcommand*!twelvebackslash{\}} +% \Define\bslash \Define\xiibackslash +\foone{\catcode`\!=0 + \@makeother\\} +{!newcommand*!xiibackslash{\}} %^^A] balancing braces for Emacs % \CodeEscapeChar\\ -\@ifundefined{bslash}{\let\bslash=\twelvebackslash}{} +\@ifundefined{bslash}{\let\bslash=\xiibackslash}{} -% \CodeDefine\twelvepercent % \begin{oldmc} -\begingroup \@makeother\% -\firstofone{\endgroup - \def\twelvepercent{%}} +\foone{\@makeother\%} +{\def\xiipercent{%}} % \end{oldmc} -% \CodeDefine\twelveand -\begingroup \@makeother\&% -\firstofone{\endgroup% - \def\twelveand{&}} +\foone{\@makeother\&}% +{\def\xiiand{&}} -% \CodeDefine\twelvespace -\begingroup\@makeother\ % -\firstofone{\endgroup% -\def\twelvespace{ }} +\foone{\@makeother\ }% +{\def\xiispace{ }} %\division{Metasymbols} % I~fancy also another Knuthian trick for typesetting \ @@ -607,7 +656,7 @@ % which has no patterns associated with it and use this to typeset the words within % the angle brackets. % \end{quotation} -% \CodeDefine\meta \CodeDefIndex\l@nohyphenation +% \Define\meta \DefIndex\l@nohyphenation \ifx\l@nohyphenation\undefined \newlanguage\l@nohyphenation \fi @@ -625,7 +674,7 @@ \meta@font@select % Need to keep track of what we changed just in case the user changes font inside % the argument so we store the font explicitly. -% \CodeDefIndex\meta@hyphen@restore +% \DefIndex\meta@hyphen@restore \edef\meta@hyphen@restore{% \hyphenchar\the\font\the\hyphenchar\font}% \hyphenchar\font\m@ne @@ -635,7 +684,7 @@ }\ensuremath\rangle } -% \CodeDefIndex\meta@font@select +% \DefIndex\meta@font@select % \changes {v0.76}{06/9/21}{\cs{itshape} changed to an explicit and % violent \cs{it} to work as expected in \cs{cs}'s argument} % But I~define |\meta@font@select| as the brutal and explicit |\it| @@ -646,7 +695,7 @@ % The below |\meta|'s drag\footnote{Think of the drags that transform ^^B % a~very nice but rather standard `auntie' (`Tante' in Deutsch) into ^^B( % a~most adorable Queen ;-)\,.} is a~version of \TeXbook's one. -% \CodeDefine*{\<...>} +% \Define*{\<...>} \def\<#1>{\meta{#1}} % \division{Macros for Printing Macros and Filenames} @@ -657,7 +706,7 @@ % a~linebreak just before nor just after themselves. The % |\discretionary| \TeX\ primitive has three arguments: |#1| `before % break', |#2| `after break', |#3| `without break', remember? -% \CodeDefine\discre \CodeDefine\discret +% \Define\discre \Define\discret \def\discre#1#2#3{\kern0sp\discretionary{#1}{#2}{#3}\penalty10000\hskip0sp\relax} \def\discret#1{\kern0sp\discretionary{#1}{#1}{#1}\penalty10000\hskip0sp\relax} @@ -665,14 +714,14 @@ % has its original meaning inside math. \def\:{\ifmmode\afterfi{\mskip\medmuskip}\else\afterfi{\discret{}}\fi} -% \CodeDefine\vs +% \Define\vs \newcommand*{\vs}{\discre{\textvisiblespace}{}{\textvisiblespace}} % Then we define a~macro that makes the spaces visible even if used in % an argument (i.e., in a~situation where re|\catcode|ing has no % effect). % -% \CodeDefine\printspaces +% \Define\printspaces %^^A\def\printspaces#1{\gm@printspaces#1\@@nil} %^^A CodeDefIndex\gm@printspaces % ^^A~originally it has a~version with the argument delimited with / @@ -680,21 +729,21 @@ % ^^A A~test: \printspaces{Ala ma kota }\par % ^^A \printspaces{Ala ma aligatora} \def\printspaces#1{{\let~=\vs \let\ =\vs \gm@pswords#1 \@@nil}} -% \CodeDefIndex\gm@pswords +% \DefIndex\gm@pswords \def\gm@pswords#1 #2\@@nil{% - \if\relax#1\relax\else#1\fi - \if\relax#2\relax\else\vs\penalty\hyphenpenalty\gm@pswords#2\@@nil\fi}% note + \ifx\relax#1\relax\else#1\fi + \ifx\relax#2\relax\else\vs\penalty\hyphenpenalty\gm@pswords#2\@@nil\fi}% note % that in the recursive call of |\gm@pswords| the argument string is % not extended with a~guardian space: it has been already by % |\printspaces|. -% \CodeDefine\sfname \CodeDefine\file +% \Define\sfname \Define\file \DeclareRobustCommand*\sfname[1]{\textsf{\printspaces{#1}}} \let\file\sfname% it allows the spaces in the filenames (and prints % them as \vs). % The below macro I~use to format the packages' names. -% \CodeDefine\pk \CodeDefine\file +% \Define\pk \Define\file \DeclareRobustCommand*{\pk}[1]{\textsf{\textup{#1}}} % Some (if not all) of the below macros are copied from \pk{doc} @@ -705,16 +754,22 @@ % calls |\ttfamily| not |\tt| to be usable in headings which are % boldface sometimes. % -% \CodeDefine\cs +% \Define\cs \DeclareRobustCommand*{\cs}[2][\bslash]{{% \def\-{\discretionary{{\rmfamily-}}{}{}}% \def\{{\char`\{}\def\}{\char`\}}\ttfamily #1#2}} -% \CodeDefine\env +% \Define\env % \changes{v0.66}{06/09/29}{the braces removed} \DeclareRobustCommand*{\env}[1]{\cs[]{#1}} + +% And for the special sequences like |^^A|: +\foone{\@makeother\^} + {\DeclareRobustCommand*\hathat[1]{\cs[^^]{#1}}} + + % And one for encouraging linebreaks e.g., before long verbatim words. -% \CodeDefine\possfil +% \Define\possfil \newcommand*\possfil{\hfil\penalty1000\hfilneg} % The five macros below are taken from the \pk{ltxdoc.dtx}. @@ -724,32 +779,32 @@ % syntax. (This second form may even be used when |\foo| is % |\outer|).\end{quotation} % -% \CodeDefine\cmd +% \Define\cmd \def\cmd#1{\cs{\@xa\cmd@to@cs\string#1}} -% \CodeDefIndex\cmd@to@cs +% \DefIndex\cmd@to@cs \def\cmd@to@cs#1#2{\char\number`#2\relax} % |\marg{text}| prints \marg{text}, `mandatory argument'. -% \CodeDefine\marg +% \Define\marg \def\marg#1{{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} % |\oarg{text}| prints \oarg{text}, `optional argument'. % Also |\oarg[text]| does that. -% \CodeDefine\oarg +% \Define\oarg \def\oarg{\@ifnextchar[\@oargsq\@oarg} %^^A] \def\@oarg#1{{\ttfamily[}\meta{#1}{\ttfamily]}} \def\@oargsq[#1]{\@oarg{#1}} % |\parg{te,xt}| prints \parg{te,xt}, `picture mode argument'. -% \CodeDefine\parg +% \Define\parg \def\parg{\@ifnextchar(\@pargp\@parg} %^^A) \def\@parg#1{{\ttfamily(}\meta{#1}{\ttfamily)}} \def\@pargp(#1){\@parg{#1}} % But we can have all three in one command. -% \CodeDefine\arg +% \Define\arg \AtBeginDocument{% \let\math@arg\arg \def\arg{\ifmmode\math@arg\else\afterfi{% @@ -760,11 +815,19 @@ % \division{Storing and Restoring the Meanings of CSs} % +% First a~Boolean switch af globalness of assignments and +% its verifier. +\newif\ifgmu@SMglobal + +\def\SMglobal{\gmu@SMglobaltrue} +% The subsequent commands are defined in such a~way that you can +% `prefix' them with |\SMglobal| to get global (re)storing. +% \stanza % A~command to store the current meaning of a~CS in another macro to % temporarily redefine the CS and be able to set its original meanig % back (when grouping is not recommended): % -%\CodeDefine\StoreMacro +%\Define\StoreMacro %\changes{v0.61}{06/09/05}{added.} %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} \def\StoreMacro{% @@ -774,12 +837,25 @@ \long\def\egStore@MacroSt#1{\egroup\Store@MacroSt{#1}} \long\def\Store@Macro#1{% - \@xa\let\csname /gml/store\string#1\endcsname#1} + \escapechar92 + \ifgmu@SMglobal\afterfi\global\fi + \@xa\let\csname /gmu/store\string#1\endcsname#1% + \global\gmu@SMglobalfalse} + \long\def\Store@MacroSt#1{% \edef\gmu@smtempa{% - \@nx\let\@xa\@nx\csname/gml/store#1\endcsname\@xa\@nx\csname#1\endcsname} - \gmu@smtempa} + \ifgmu@SMglobal\global\fi + \@nx\let\@xa\@nx\csname/gmu/store\bslash#1\endcsname%\label{SMbslash} + % we add backslash because to ensure compatibility between + % \cs{(Re)StoreMacro} and \cs{(Re)StoreMacro*}, that is. to allow + % writing e.g. |\StoreMacro\kitten| and then + % |\RestoreMacro*{kitten}| to restore the meaning of |\kitten|. + \@xa\@nx\csname#1\endcsname} + \gmu@smtempa + \global\gmu@SMglobalfalse}% we wish the globality to be just + % once.\par + % We make the |\StoreMacro| command a~three-step to allow usage of the % most inner macro also in the next command. % @@ -791,33 +867,43 @@ % % The next command iterates over a~list of CSs and stores each of % them. The CS may be separated with commas but they don't have to. -% \CodeDefine\StoreMacros +% \Define\StoreMacros + \long\def\StoreMacros{\bgroup\makeatletter\Store@Macros} \long\def\Store@Macros#1{\egroup + \gmu@setsetSMglobal \let\gml@StoreCS\Store@Macro \gml@storemacros#1.} % \label{InnerStore} +\def\gmu@setsetSMglobal{% + \ifgmu@SMglobal + \let\gmu@setSMglobal\gmu@SMglobaltrue + \else + \let\gmu@setSMglobal\gmu@SMglobalfalse + \fi} + % And the inner iterating macro: \long\def\gml@storemacros#1{% - \def\@tempa{\@nx#1}% My \TeX\ Guru's trick to deal with |\fi| + \def\gmu@reserveda{\@nx#1}% My \TeX\ Guru's trick to deal with |\fi| % and such, i.e., to hide |#1| from \TeX\ when it is processing a~test's % branch without expanding. - \if\@tempa.% a~dot finishes storing. + \if\gmu@reserveda.% a~dot finishes storing. + \global\gmu@SMglobalfalse \else - \if\@tempa,% The list this macro is put before may + \if\gmu@reserveda,% The list this macro is put before may % contain commas and that's O.K., we just continue the work. \afterfifi\gml@storemacros \else% what is else this shall be stored. \gml@StoreCS{#1}% we use a~particular CS to may |\let| it both to % the storing macro as above and to the restoring one as % \gmiflink[letRestore]{below}. - \afterfifi\gml@storemacros + \afterfifi{\gmu@setSMglobal\gml@storemacros}% \fi \fi} % And for the restoring -%\CodeDefine\RestoreMacro +%\Define\RestoreMacro %\changes{v0.61}{06/09/05}{added.} %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} \def\RestoreMacro{% @@ -827,16 +913,25 @@ \long\def\egRestore@MacroSt#1{\egroup\Restore@MacroSt{#1}} \long\def\Restore@Macro#1{% - \@xa\let\@xa#1\csname /gml/store\string#1\endcsname} + \escapechar92 + \ifgmu@SMglobal\afterfi\global\fi + \@xa\let\@xa#1\csname /gmu/store\string#1\endcsname + \global\gmu@SMglobalfalse} \long\def\Restore@MacroSt#1{% \edef\gmu@smtempa{% - \@nx\let\@xa\@nx\csname#1\endcsname\@xa\@nx\csname/gml/store#1\endcsname} - \gmu@smtempa} - -% \CodeDefine\RestoreMacros + \ifgmu@SMglobal\global\fi + \@nx\let\@xa\@nx\csname#1\endcsname + \@xa\@nx\csname/gmu/store\bslash#1\endcsname}% cf. the commentary + % in line \ref{SMbslash}. + \gmu@smtempa + \global\gmu@SMglobalfalse} + +% \Define\RestoreMacros \long\def\RestoreMacros{\bgroup\makeatletter\Restore@Macros} + \long\def\Restore@Macros#1{\egroup + \gmu@setsetSMglobal \let\gml@StoreCS\Restore@Macro% \gmhypertarget[letRestore]{we} % direct the core CS towards restoring and call the same iterating % macro as in line \ref{InnerStore}. @@ -856,35 +951,58 @@ % of |\do| of course. So here is this proper definition of |\do|, % provided as a~macro (a~declaration). % -% \CodeDefine\StoringAndRelaxingDo +% \Define\StoringAndRelaxingDo % \changes{v0.59}{06/09/04}{added for storing index-related macros in % \pk{gmdoc}'s \cs{DocInclude}.} % \changes{v0.61}{06/09/05}{renamed from \cs{MacroStoringDo} and the % storing cs's prefix changed from \cs[]{@gml@srs}.} -\long\def\StoringAndRelaxingDo{% - \def\do##1{\@xa\let\csname /gml/store\string##1\endcsname##1% - \let##1\relax}} - +\long\def\StoringAndRelaxingDo{% + \gmu@SMdo@setscope + \long\def\do##1{% + \gmu@SMdo@scope + \@xa\let\csname /gmu/store\string##1\endcsname##1% + \gmu@SMdo@scope\let##1\relax}} + +\def\gmu@SMdo@setscope{% + \ifgmu@SMglobal\let\gmu@SMdo@scope\global + \else\let\gmu@SMdo@scope\relax + \fi + \global\gmu@SMglobalfalse} % And here is the counter-definition for restore. % -% \CodeDefine\RestoringDo +% \Define\RestoringDo % \changes{v0.59}{06/09/04}{added for restoring index-related macros in % \pk{gmdoc}'s \cs{DocInclude}.} % \changes{v0.61}{06/09/05}{renamed from \cs{MacroRestoringDo} and % relaxing of the storing cs removed.} \long\def\RestoringDo{% - \def\do##1{% - \@xa\let\@xa##1\csname /gml/store\string##1\endcsname}} + \gmu@SMdo@setscope + \long\def\do##1{% + \gmu@SMdo@scope + \@xa\let\@xa##1\csname /gmu/store\string##1\endcsname}} +% Note that both |\StoringAndRelaxingDo| and |\RestoringDo| are +% sensitive to the |\SMglobal| `prefix'. + % And to store a~cs as explicitly named cs, i.e. to |\let| one csname % another (|\n@melet| not |\@namelet| becasuse the latter is defined -% in Till Tantau's \pk{beamer} class another way): +% in Till Tantau's \pk{beamer} class another way) (both arguments +% should be text): \def\n@melet#1#2{% - \edef\@tempa{% + \edef\gmu@nl@reserveda{% \let\@xa\@nx\csname#1\endcsname \@xa\@nx\csname#2\endcsname}% - \@tempa} + \gmu@nl@reserveda} + +% The |\global| prefix doesn't work with |\n@melet| so we define the +% alternative. +\def\gn@melet#1#2{% + \edef\gmu@nl@reserveda{% + \global\let\@xa\@nx\csname#1\endcsname + \@xa\@nx\csname#2\endcsname}% + \gmu@nl@reserveda} + % \division{Not only preamble!} @@ -894,7 +1012,7 @@ % commands should be rethought \IMO. -% \CodeDefine\not@onlypreamble +% \Define\not@onlypreamble % \changes{v0.79}{2007/04/28}{All the actions are done in a~group and % therefore \cs{xdef} used instead of \cs{edef} because this command % has to use \cs{do} (which is contained in the \cs{@preamblecmds} @@ -949,15 +1067,15 @@ % meaning of reference is extended. Such an extension also my % automatic pronouns do suggest. It's \emph{not} political % correctness, it's just respect to people's diversity. -% \CodeDefIndex*{gm@PronounGender} -% \let\do\CodeDefine +% \DefIndex*{gm@PronounGender} +% \let\do\Define % \do\gm@atppron \do\heshe \do\hisher \do\himher \do\hishers % \do\HeShe \do\HisHer \do\HimHer \do\HisHers \newcounter{gm@PronounGender} \newcommand*\gm@atppron[2]{% \stepcounter{gm@PronounGender}% remember |\stepcounter| is global. - \ifodd\arabic{gm@PronounGender}#1\else#2\fi} + \ifodd\value{gm@PronounGender}#1\else#2\fi} \newcommand*\heshe{\gm@atppron{he}{she}} \newcommand*\hisher{\gm@atppron{his}{her}} @@ -973,7 +1091,7 @@ % % It's a~contribution to \TeX's ecology \gobble(;-). You can use as % many CSs as you wish and you may use only 256 count registers -% (although in e\TeX\ there are $2^{16}$ count registers, which makes +% (although in \eTeX\ there are $2^{16}$ count registers, which makes % the following a~bit obsolete). \newcommand*\nummacro[1]{\gdef#1{0}} @@ -1053,7 +1171,7 @@ % % But let's make a~shorthand for this test since we'll use it three % times in this package and maybe also somewhere else. -% \CodeDefine\@ifnotmw +% \Define\@ifnotmw \long\def\@ifnotmw#1#2{\@ifundefined{mw@sectionxx}{#1}{#2}} \let\gmu@def\def @@ -1144,14 +1262,253 @@ \fi% of |\if\mw@HeadingWholeWidth| \fi% of |\if\mw@HeadingRunIn| } -%%%% (End of Experimente with MW sectioning.) +%^^A%%% (End of Experimente with MW sectioning.) + +% +% \subdivision{An improvement of MW's \cs{SetSectionFormatting}} +% +% A~version of MW's |\SetSectionFormatting| that lets to leave some +% settings unchanged by leaving the respective argument empty (|{}| or +% |[]|). +% +% Notice: If we adjust this command for new version of \acro{MWCLS}, +% we should name it |\SetSectionFormatting| and add issuing errors if +% the inner macros are undefined. +\relaxen\SetSectionFormatting +\newcommand*\SetSectionFormatting[5][\empty]{% + \ifx\empty#1\relax\else% empty (not |\empty|!) |#1| also launches |\else|. + \def\mw@HeadingRunIn{10}\def\mw@HeadingBreakBefore{10}% + \def\mw@HeadingBreakAfter{10}\def\mw@HeadingWholeWidth{10}% + \@ifempty{#1}{}{\mw@processflags#1,\relax}% If |#1| is omitted, + % the flags are left unchanged. If |#1| is given, even as [], the + % flags are first cleared and then processed again. + \fi + \@ifundefined{#2}{\@namedef{#2}{\mw@section{#2}}}{}% + \mw@secdef{#2}{@preskip} {#3}{2 oblig.}% + \mw@secdef{#2}{@head} {#4}{3 oblig.}% + \mw@secdef{#2}{@postskip}{#5}{4 oblig.}% + \ifx\empty#1\relax + \mw@secundef{#2@flags}{1 (optional)}% + \else\mw@setflags{#2}% + \fi} +\def\mw@secdef#1#2#3#4{% |#1| the heading name,\\ +% |%| |#2| the command distinctor, \\ +% |%| |#3| the meaning, \\ +% |%| |#4| the number of argument to error message. + \@ifempty{#3} + {\mw@secundef{#1#2}{#4}} + {\@namedef{#1#2}{#3}}} + +\def\mw@secundef#1#2{% + \@ifundefined{#1}{% + \ClassError{mwcls/gm}{% + command \bslash#1 undefined \MessageBreak + after \bslash SetSectionFormatting!!!\MessageBreak}{% + Provide the #2 argument of \bslash SetSectionFormatting.}}{}} + + +% First argument is a~sectioning command (wo. |\|) and second the +% stuff to be added at the beginning of the heading declarations. +\def\addtoheading#1#2{% + \n@melet{gmu@reserveda}{#1@head}% + \toks\z@=\@xa{\gmu@reserveda}% + \toks\tw@={#2}% + \edef\gmu@reserveda{\the\toks\tw@\the\toks\z@}% + \n@melet{#1@head}{gmu@reserveda}% +%^^A \@xa\show\csname#1@head\endcsname +} + +% \subdivision{Negative \cs{addvspace}} When two sectioning commands +% appear one after another (we may assume that this occurs only when +% a~lower section appears immediately after higher), we prefer to put +% the \emph{smaller} vertical space not the larger, that is, the +% preskip of the lower sectioning not the postskip of the higher. +% +% For that purpose we modify the very inner macros of \acro{MWCLS} +% to introduce a~check whether the previous vertical space equals the +% postskip of the section one level higher. + +\@ifnotmw{}{% We proceed only in \acro{MWCLS} + +% The information that we are just after a~heading will be stored in +% the |\gmu@prevsec| macro: any heading will define it as the section +% name and |\everypar| (any normal text) will clear it. + \def\@afterheading{% + \@nobreaktrue + \xdef\gmu@prevsec{\mw@HeadingType}% added now + \everypar{% + \grelaxen\gmu@prevsec% added now. All the rest is original \LaTeX. + \if@nobreak + \@nobreakfalse + \clubpenalty \@M + \if@afterindent \else + {\setbox\z@\lastbox}% + \fi + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}} + +% If we are (with the current heading) just after another heading (one +% level lower I~suppose), then we add the less of the higher header's +% post-skip and the lower header pre-skip or, if defined, the +% two-header-skip. (We put the macro defined below just before +% |\addvspace| in MWCLS inner macros. + \def\gmu@checkaftersec{% + \@ifundefined{gmu@prevsec}{}{% + \ifgmu@postsec% an additional switch that is true by default but + % may be turned into an \cs{ifdim} in special + % cases, see line \ref{gmu@postsec}. + {\@xa\mw@getflags\@xa{\gmu@prevsec}% + \glet\gmu@reserveda\mw@HeadingBreakAfter}% + \if\mw@HeadingBreakBefore\def\gmu@reserveda{11}\fi% if the + % current heading inserts page break before itself, all the play + % with vskips is irrelevant. + \if\gmu@reserveda\else + \penalty10000\relax + \skip\z@=\csname\gmu@prevsec @postskip\endcsname\relax + \skip\tw@=\csname\mw@HeadingType @preskip\endcsname\relax + \@ifundefined{\mw@HeadingType @twoheadskip}{ + \ifdim\skip\z@>\skip\tw@ + \vskip-\skip\z@% we strip off the post-skip of previous + % header if it's bigger than current pre-skip + \else + \vskip-\skip\tw@% we strip off the current pre-skip otherwise + \fi}{% But if the two-header-skip is defined, we put + % \emph{it} + \penalty10000 + \vskip-\skip\z@ + \penalty10000 + \vskip-\skip\tw@ + \penalty10000 + \vskip\csname\mw@HeadingType @twoheadskip\endcsname + \relax}% + \penalty10000 + \hrule height\z@\relax% to hide the last (un)skip before subsequent + % |\addvspace|s. + \penalty10000 + \fi + \fi + }% of |\@ifundefined{gmu@prevsec}| `else' + }% of |\def\gmu@checkaftersec| + + \def\ParanoidPostsec{% \label{gmu@postsec} this version of + % \inverb|\ifgmu@postsec| is intended for the special case of + % sections may contain no normal text, as while \pk{gmdoc}ing. + \def\ifgmu@postsec{% note this macro expands to an open \cs{if}. + \skip\z@=\csname\gmu@prevsec @postskip\endcsname\relax + \ifdim\lastskip=\skip\z@\relax% we play + % with the vskips only if the last skip is the previous + % heading's postskip (a~counter-example I~met while + % \pk{gmdoc}ing). + }} + + \let\ifgmu@postsec\iftrue + + \def\gmu@getaddvs#1\addvspace#2\gmu@getaddvs{% + \toks\z@={#1} + \toks\tw@={#2}} + + % And the modification of the inner macros at last: + \def\gmu@setheading#1{% + \@xa\gmu@getaddvs#1\gmu@getaddvs + \edef#1{% + \the\toks\z@\@nx\gmu@checkaftersec + \@nx\addvspace\the\toks\tw@}} + + \gmu@setheading\mw@normalheading + \gmu@setheading\mw@runinheading + + \def\SetTwoheadSkip#1#2{\@namedef{#1@twoheadskip}{#2}} + +}% of |\@ifnotmw| + +%^^A% % \subdivision{Feature fix for \pk{gmdoc}} +%^^A% % +%^^A% % I'm not sure whether call it `bug' but it happens while +%^^A% % \pk{gmodc}ing that between two headers only code appears no `normal' +%^^A% % text, the commentary that is. And the code layer redefines +%^^A% % |\everypar| so the next heading `thinks' it is next to the previous +%^^A% % heading and does those special things with the skips when in +%^^A% % \pk{mwcls}. Therefore we provide two-heading skips for all the +%^^A% % headings in \pk{gmdoc} equal to the respective preskips whatever +%^^A% % those preskips may be. +%^^A% +%^^A% \@ifnotmw{}{% +%^^A% \AtBeginDocument{% +%^^A% \@ifpackageloaded{gmdoc}{% +%^^A% \def\do#1{% +%^^A% \@namedef{#1@twoheadskip}{\csname#1@preskip\endcsname}}% +%^^A% \do{part}% +%^^A% \do{section}\do{subsection}\do{subsubsection}% +%^^A% \do{paragraph}\do{subparagraph}% +%^^A% \@ifundefined{chapter}{}{\do{chapter}}% +%^^A% }{}}} +%^^A% \fi +%^^A% commented out since the additional \ifdim in line 1358 does. + +% \subdivision{My heading setup for \pk{mwcls}} +% +% The setup of heading skips was tested in `real' typesetting, for +% money that is. The skips are designed for 11/13\,pt leading and +% together with my version of \pk{mw11.clo} option file for \pk{mwcls} +% make the headings (except paragraph and subparagraph) consist of +% an integer number of lines. The name of the declaration comes from +% my employer, ``Wiedza Powszechna'' Editions. + +\@ifnotmw{}{% We define this declaration only when in \pk{mwcls}. +\def\WPheadings{% + \SetSectionFormatting[breakbefore,wholewidth] + {part}{\z@\@plus1fill}{}{\z@\@plus3fill}% + % + \@ifundefined{chapter}{}{% + \SetSectionFormatting[breakbefore,wholewidth] + {chapter} + {66\p@}% |{67\p@}|% for Adventor/Schola 0,95. + {\FormatHangHeading{\LARGE}} + {27\p@\@plus0,2\p@\@minus1\p@}% + }% + % + \SetTwoheadSkip{section}{27\p@\@plus0,5\p@}% + \SetSectionFormatting{section} + {24\p@\@plus0,5\p@\@minus5\p@}% ^^A {24\p@\@plus5\p@\@minus2\p@} + {\FormatHangHeading {\Large}} + {10\p@\@plus0,5\p@}% ed. Krajewska of ``Wiedza Powszechna'', as + % we understand her, wants the skip between a~heading and text + % to be rigid. + % + \SetTwoheadSkip{subsection}{11\p@\@plus0,5\p@\@minus1\p@}% + \SetSectionFormatting{subsection} + {19\p@\@plus0,4\p@\@minus6\p@} + {\FormatHangHeading {\large}}% 12/14 pt + {6\p@\@plus0,3\p@}% after-skip 6\,pt due to p.12, not to squeeze + % the before-skip too much. + % + \SetTwoheadSkip{subsubsection}{10\p@\@plus1,75\p@\@minus1\p@}% + \SetSectionFormatting{subsubsection} + {10\p@\@plus0,2\p@\@minus1\p@} + {\FormatHangHeading {\normalsize}} + {3\p@\@plus0,1\p@}% those little skips should be smaller than + % you calculate out of a~geometric progression, because the + % interline skip enlarges them. + % + \SetSectionFormatting[runin]{paragraph} + {7\p@\@plus0,15\p@\@minus1\p@} + {\FormatRunInHeading{\normalsize}} + {2\p@}% + % + \SetSectionFormatting[runin]{subparagraph} + {4\p@\@plus1\p@\@minus0,5\p@} + {\FormatRunInHeading{\normalsize}} + {\z@}% +}% of |\WPheadings| +}% of |\@ifnotmw| -% % \division{Compatibilising Standard and \pk{mwcls} Sectionings} % -% If you use Marcin Woli\'nski's document classes (\pk{mwcls}), you +% If you use Marcin Woli\nacute ski's document classes (\pk{mwcls}), you % might have met their little queerness: the sectioning commands take % two optional arguments instead of standard one. It's reasonable % since one may wish one text to be put into the running head, @@ -1191,7 +1548,7 @@ % handle \pk{mwcls}-like sectionings i.e., those written with two % optionals. \def\gm@secini{gm@la}% - % \CodeDefine\gm@secxx + % \Define\gm@secxx \def\gm@secxx#1#2[#3]#4{% \ifx\gm@secstar\@empty \n@melet{gm@true@#1mark}{#1mark}% a~little trick to allow @@ -1219,7 +1576,7 @@ % \let\gm@secmarkh\@gobble% in \pk{mwcls} there's no need to make % tricks for special version to running headings. - % \CodeDefine\gm@secxx + % \Define\gm@secxx \def\gm@secxx#1#2[#3]#4{% \@xa\@xa\csname\gm@secini#1\endcsname \gm@secstar[#2][#3]{#4}}% @@ -1229,7 +1586,7 @@ \def\gm@secx#1[#2]{% \@ifnextchar[{\gm@secxx{#1}{#2}}{\gm@secxx{#1}{#2}[#2]}}% if % there's only one optional, we double \emph{it} not the mandatory -% argument. ^^A] +% argument. ^^A} \def\gm@straightensec#1{% the parameter is for the command's name. \@ifundefined{#1}{}{% we don't change the ontological status of the @@ -1247,17 +1604,17 @@ % capacity exceeded' error. Anyway, who on Earth wants paragraph % titles in toc or running head? % - +% % \division{\env{enumerate*} and \env{itemize*}} % We wish the starred version of \env{enumerate} to be just numbered % paragraphs. But \pk{hyperref} redefines |\item| so we should do it % a~smart way, to set the \LaTeX's \env{list} parameters that is. % -% (Marcin Woli\'nski in \pk{mwcls} defines those environments slightly +% (Marcin Woli\nacute ski in \pk{mwcls} defines those environments slightly % different: his item labels are indented, mine are not; his % subsequent paragraphs of an item are not indented, mine are.) % -% \CodeDefine*{enumerate*} +% \Define*{enumerate*} \@namedef{enumerate*}{% \ifnum\@enumdepth>\thr@@ \@toodeep @@ -1266,7 +1623,7 @@ \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \@xa\list\csname label\@enumctr\endcsname{% \partopsep\topsep \topsep\z@ \leftmargin\z@ - \itemindent\@parindent %\advance\itemindent\labelsep + \itemindent\@parindent %|%\advance\itemindent\labelsep| \labelwidth\@parindent \advance\labelwidth-\labelsep \listparindent\@parindent @@ -1275,7 +1632,7 @@ \fi} \@namedef{endenumerate*}{\endlist} -% \CodeDefine*{itemize*} +% \Define*{itemize*} \@namedef{itemize*}{% \ifnum\@itemdepth>\thr@@ \@toodeep @@ -1293,6 +1650,7 @@ \@namedef{enditemize*}{\endlist} + % \division{The Logos} % % We'll modify The \LaTeX\ logo now to make it fit better to various @@ -1309,18 +1667,20 @@ % |#2| is the command, its name will be the PD1 spelling by % default,\\ % |#3| is the definition for all the font encodings except PD1. - \ifx\relax#1\def\@tempa{\@xa\@gobble\string#2}% + \ifx\relax#1\def\gmu@reserveda{\@xa\@gobble\string#2}% \else - \def\@tempa{#1}% + \def\gmu@reserveda{#1}% \fi - \edef\@tempa{% - \@nx\DeclareTextCommand\@nx#2{PD1}{\@tempa}} - \@tempa - \DeclareTextCommandDefault#2{#3}} - + \edef\gmu@reserveda{% + \@nx\DeclareTextCommand\@nx#2{PD1}{\gmu@reserveda}} + \gmu@reserveda + \DeclareTextCommandDefault#2{#3}% + \DeclareRobustCommand*#2{#3}}% added for \XeTeX +% \DeclareDefining\DeclareLogo \DeclareLogo\LaTeX{% {% +%^^A\typeout{***** LaTeX logo of GM ^^J}\show\relax L% \setbox\z@\hbox{\check@mathfonts \fontsize\sf@size\z@ @@ -1344,16 +1704,17 @@ \fi}% \TeX} - \DeclareLogo\LaTeXe{\mbox{\m@th \if b\expandafter\@car\f@series\@nil\boldmath\fi \LaTeX\kern.15em2$_{\textstyle\varepsilon}$}} - +\StoreMacro\LaTeX +\StoreMacro*{LaTeX } +% \label{SMLaTeX} % `\LaTeXpar' in my opinion better describes what I~work with/in than % just `\LaTeX'. -% \CodeDefine\LaTeXpar +% \Define\LaTeXpar \DeclareLogo[(La)TeX]{\LaTeXpar}{% {% \setbox\z@\hbox{(}%) @@ -1375,6 +1736,61 @@ \kern-.2\wd\z@}\TeX } +% \begin{quotation} Here are a few definitions which can usefully be +% employed when documenting +% package files: now we can readily refer to \AmSTeX, \BibTeX\ and \SliTeX, as well +% as the usual \TeX\ and \LaTeX. There's even a \PlainTeX\ and +% a~\Web.\end{quotation} +\@ifundefined{AmSTeX} + {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex% + \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{} + +\DeclareLogo\BibTeX{{\rmfamily B\kern-.05em% + \textsc{i{\kern-.025em}b}\kern-.08em% the kern is wrapped in + % braces for my |\fakescaps|' sake. + \TeX}} + + +\DeclareLogo\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox + {\scshape i}\kern -.03em\TeX}} + +\DeclareLogo\PlainTeX{\textsc{Plain}\kern2pt\TeX} + +\DeclareLogo\Web{\textsc{Web}} +% There's also the \LaTeXpar\ logo got with the |\LaTeXpar| macro +% provided by \pk{gmutils}. And here \TeXbook's logo: +\DeclareLogo[The TeX book]\TeXbook{\textsl{The \TeX book}} +\let\TB\TeXbook% \textit{TUG Boat} uses this. + +\DeclareLogo[e-TeX]\eTeX{% + \ensuremath{\varepsilon}-\kern-.125em\TeX}% definition sent by Karl +% Berry from \textit{TUG Boat} itself. + +\DeclareLogo[pdfe-TeX]\pdfeTeX{pdf\eTeX} + +\DeclareLogo\pdfTeX{pdf\TeX} + +%^^A\@ifXeTeX{}{} +\@ifundefined{XeTeX}{% + \DeclareLogo\XeTeX{X\kern-.125em\relax + \@ifundefined{reflectbox}{% + \lower.5ex\hbox{E}\kern-.1667em\relax}{% + \lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\relax}% + \TeX}}{} + +\@ifundefined{XeLaTeX}{% + \DeclareLogo\XeLaTeX{X\kern-.125em\relax + \@ifundefined{reflectbox}{% + \lower.5ex\hbox{E}\kern-.1667em\relax}{% + \lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\relax}% + \LaTeX}} +% As you see, if \TeX\ doesn't recognize \nlpercent\cs{re\+flect\+box} +% (\pk{graphics} isn't loaded), the first |E| will not be reversed. +% This version of the command is intended for non-\XeTeX\ usage. With +% \XeTeX, you can load the \pk{xltxtra} package (e.g. with the +% \pk{gmutils} |\XeTeXthree| declaration) and then the reversed |E| +% you get as the Unicode Latin Letter Reversed E. + % \division{Expanding turning stuff all into `other'} @@ -1385,13 +1801,13 @@ % make all the name `other'. So---here we are. % % Don't use them in |\edef|s, they would expand not quite. -% \CodeDefine\unex@namedef \CodeDefine\unex@nameuse +% \Define\unex@namedef \Define\unex@nameuse % The next macro turns its |#2| all into `other' chars and assigns % them to |#1| which has to be a~CS or an active char. % -% \CodeDefine\def@other +% \Define\def@other \long\def\def@other#1#2{% \long\def\gm@def@other@tempa{#2}% @@ -1400,38 +1816,187 @@ % The next macro is intended to be put in |\edef|s with a~macro % argument. The meaning of the macro will be made all `other' and the % words '(long) macro:->' gobbled. -%\CodeDefine\all@other +%\Define\all@other \def\all@other#1{\@xa\gm@gobmacro\meaning#1} % The |\gm@gobmacro| macro above is applied to gobble the |\meaning|'s % beginnig, |long macro:->| all `other' that is. % -% \CodeDefine\gm@gobmacro -\edef\@tempa{% +% \Define\gm@gobmacro +\edef\gmu@reserveda{% \def\@nx\gm@gobmacro##1\@xa\@gobble\string\macro:->{}} -\@tempa +\gmu@reserveda % In the next two macros' names, `unex' stands both for not expanding % the argument(s) and for disastrously partial unexpandability of the % macros themselves. \long\def\unex@namedef#1#2{% - \edef@other\gmu@tempa{#1}% - \@xa\long\@xa\def\csname\gmu@tempa\endcsname{#2}} + \edef@other\gmu@reserveda{#1}% + \@xa\long\@xa\def\csname\gmu@reserveda\endcsname{#2}} \long\def\unex@nameuse#1{% - \edef@other\gmu@tempa{#1}% - \csname\gmu@tempa\endcsname} - + \edef@other\gmu@reserveda{#1}% + \csname\gmu@reserveda\endcsname} + + +% \division{Brave New World of \XeTeX} + +\newcommand\@ifXeTeX[2]{% + \@xa\ifx\csname XeTeXversion\endcsname\relax + \afterfi{#2}\else\afterfi{#1}\fi} + +%^^A \Define\withXeTeX +%^^A~\let\withXeTeX\@ifXeTeX + +\def\XeTeXthree{% + \@ifXeTeX{% +%^^A \SMglobal\StoreMacro\LaTeX +%^^A \SMglobal\StoreMacro*{LaTeX }% we want \emph{our} version +%^^A of |\LaTeX|. + \RequirePackage{fontspec}% + \RequirePackage{xunicode}% + \RequirePackage{xltxtra}% + \AtBeginDocument{% + \RestoreMacro\LaTeX\RestoreMacro*{LaTeX }}% my version of the + % \LaTeX\ logo has been stored just + % after defining, in line \ref{SMLaTeX}. + % ^^A \def\dekfracc##1/##2{\vfrac{##1}{##2}} +}{}} + + +% The |\udigits| declaration causes the digits to be typeset +% uppercase. I~provide it since by default I~prefer the lowercase +% (nautical) digits. +\AtBeginDocument{% + \@ifpackageloaded{fontspec}{% + \DeclareRobustCommand*\udigits{% + \addfontfeature{Numbers=Uppercase}}% + }{% + \emptify\udigits}} + + +% \subdivision{Fractions} + +\def\Xedekfracc{\@ifstar{% +% Minion GM doesn't feature the |frac| font feature properly so, with +% the starred version of the declaration we use the characters from +% the font where available (see the |\@namedef|s below) and the |numr| +% and |dnom| features with the fractional slash otherwise (via +% |\gmu@dekfracc|). + \def\gmu@dekfracc########1/########2{% + {\addfontfeature{VerticalPosition=Numerator}########1}\kern-0.05em + \char"2044\kern-.05em + {\addfontfeature{VerticalPosition=Denominator}########2}}% +% +% We define the fractional macros. Since Adobe Minion Pro doesn't +% contain $\frac n5$ nor $\frac n6$, we don't provide them here. + \@namedef{gmu@xefracc1/4}{\char"BC\relax}% + \@namedef{gmu@xefracc1/2}{\char"BD\relax}% + \@namedef{gmu@xefracc3/4}{\char"BE\relax}% + \@namedef{gmu@xefracc1/3}{\char"2153\relax}% + \@namedef{gmu@xefracc2/3}{\char"2154\relax}% + \@namedef{gmu@xefracc1/8}{\char"215B\relax}% + \@namedef{gmu@xefracc3/8}{\char"215C\relax}% + \@namedef{gmu@xefracc5/8}{\char"215D\relax}% + \@namedef{gmu@xefracc7/8}{\char"215E\relax}% + \def\dekfracc########1/########2{% + \@ifundefined{gmu@xefracc########1/########2}{% + \gmu@dekfracc{########1}/{########2}}{% + \csname gmu@xefracc########1/########2\endcsname}}% + }{% + \def\dekfracc####1/####2{{% + \addfontfeature{Fractions=On}% + ####1/####2}}% + \let\fnfracc\dekfracc + }} +% What have we just done? We defined two versions of the +% |\Xefractions| declaration. The starred version is intended to make +% use only of the built-in fractions such as \dekfracc1/2 or +% \dekfracc7/8. To achieve that, a~handful of macros is defined that +% expand to the Unicodes of built-in fractions and |\dekfracc| command +% is defined to use them. +% +% The unstarred version makes use of the Fraction font feature and +% therefore is much simpler. +% +% Note that in the first argument of |\@ifstar| we wrote 8 (eight) +% |#|s to get the correct definition and in the second argument `only' +% 4. (The \LaTeXe\ Source claims that that is changed in the `new +% implementation' of |\@ifstar| so maybe it's subject to change.) + + +% \subdivision{\cs{resizegraphics}} +% + +\@ifXeTeX{% + \def\resizegraphics#1#2#3{{% + \setbox0=\hbox{\XeTeXpicfile #3 }% + \ifx!#1\else + \dimen0=#1\relax + \count2=\wd0 + \divide\count2 by1000\relax + \count0=\dimen0\relax + \divide\count0\count2 + \fi + \ifx!#2\else + \dimen0=#1\relax + \count6=\ht0 + \divide\count6 by1000\relax + \count4=\dimen0\relax + \divide\count4\count6 + \fi + \ifx!#1\count0=\count4\fi + \ifx!#2\count4=\count0\fi + \XeTeXpicfile #3 xscaled \count0 yscaled \count4 + }}}{% + \def\resizegraphics#1#2#3{% + \resizebox{#1}{#2}{% + \includegraphics{#3}}}}% + +% The [options] in the |\XeTeXpicfile| command use the following keywords:\\ +% |width| \\\ +% |height| \\\ +% |scaled| \\\ +% |xscaled| \\\ +% |yscaled| \\\ +% |rotated| \ +% + +\def\GMtextsuperscript{% + \@ifXeTeX{% + \def\textsuperscript##1{{% + \addfontfeature{VerticalPosition=Numerator}##1}}% + }{\truetextsuperscript}} + +\def\truetextsuperscript{% + \DeclareRobustCommand*\textsuperscript[1]{% + \@textsuperscript{\selectfont##1}} + \def\@textsuperscript##1{% + {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@##1}}}}}} %\division{Varia} % % A~very neat macro provided by \pk{doc}. I~copy it % \*|verbatim|. -% \CodeDefine\* -\DeclareRobustCommand*\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}} +\def\gmu@tilde{% + \leavevmode\lower.8ex\hbox{$\,\widetilde{\mbox{ }}\,$}} +% Originally there was just |\ | instead of |\mbox{ }| but some +% commands of ours do redefine |\ |. +% \Define\* +\DeclareRobustCommand*\*{\gmu@tilde} +% \Define\~ +% \changes{v0.83}{2007/08/22}{postponed to +% \cs{begin\{document\}} to avoid overwriting by a~text command and +% made sensible to a~subsequent /} + +\AtBeginDocument{% to bypass redefinition of |\~| as a~text command + % with various encodings + \DeclareRobustCommand*\~{% + \@ifnextchar/{\gmu@tilde\kern-0,1667em\relax}\gmu@tilde}} +% We prepare the proper kerning for ``\~/''. % The standard |\obeyspaces| declaration just changes the space's % |\catcode| to \catactive\ (`active'). Usually it is fairly enough @@ -1442,19 +2007,16 @@ % |\gmobeyspaces| that obeys this requirement. % % (This definition is repeated in \pk{gmverb}.) -%\CodeDefine\gmobeyspaces -\begin{catcode}`\ \active -\gdef\gmobeyspaces{\catcode`\ \active\let \ } -\end{catcode} +\foone{\catcode`\ \active}% +{\def\gmobeyspaces{\catcode`\ \active\let \ }} % While typesetting poetry, I~was surprised that sth.\ didn't work. The % reason was that original |\obeylines| does |\let| not |\def|, so I~give % the latter possibility. -% \CodeDefine\defobeylines +% \Define\defobeylines % \changes{v0.62}{06/09/07}{moved from \pk{pmlectionis.cls}} -\bgroup\catcode`\^^M\active% the comment signs here are crucial. -\firstofone{\egroup% -\def\defobeylines{\catcode`\^^M=13 \def^^M{\par}}}% +\foone{\catcode`\^^M\active}% the comment signs here are crucial. +{\def\defobeylines{\catcode`\^^M=13 \def^^M{\par}}} % Another thing I~dislike in \LaTeX\ yet is doing special things for % |\...skip|'s, 'cause I~like the Knuthian simplicity. So I~sort of @@ -1462,31 +2024,28 @@ % \changes{v0.63}{06/9/8}{Plain-like skip macros % defined: \cs{deksmall/med/bigskip} i.e., moved here from % another file} -% \CodeDefine\deksmallskip \CodeDefine\dekmedskip -% \CodeDefine\dekbigskip \CodeDefine\undeksmallskip + \def\deksmallskip{\vskip\smallskipamount} \def\undeksmallskip{\vskip-\smallskipamount} \def\dekmedskip{\vskip\medskipamount} \def\dekbigskip{\vskip\bigskipamount} -% \CodeDefine\hfillneg -% \changes{v0.80}{2007/04/28}{added} + \def\hfillneg{\hskip 0pt plus -1fill\relax} +% \changes{v0.80}{2007/04/28}{added} % In some |\if(cat?)|\ test I~needed to look only at the first token of % a~tokens' string (first letter of a~word usually) and to % drop the rest of it. So I~define a~macro that expands % to the first token (or \marg{text}) of its argument. % -% \CodeDefine\@firstofmany -% \changes{v0.63}{06/9/9}{added} \long\def\@firstofmany#1#2\@@nil{#1} +% \changes{v0.63}{06/9/9}{added} % A~mark for the \TODO{}s: -% \CodeDefine\TODO -% \changes{v0.64}{06/9/17}{moved here from \pk{pmlectionis}} \newcommand*{\TODO}[1][]{{% \sffamily\bfseries\huge TODO!\if\relax#1\relax\else\space\fi#1}} +% \changes{v0.64}{06/9/17}{moved here from \pk{pmlectionis}} % \iffalse % The code contained in this iffalse I~wrote to make the table of @@ -1506,7 +2065,8 @@ % \def\write{\immediate\@@write}} % % % First I~used it for closing of \env{multicols} in the \file{.toc} -% % file. +% % file. Second time to make \emph{two} tables of contents containing +% % two different parts of the document % % CodeDefine\ImmediateAddtoConts % % changes{v0.65}{06/9/26}{added} % \newcommand\ImmediateAddtoConts[2]{{% @@ -1519,7 +2079,6 @@ % writing |\begin{multicols}{2}| and |\end{multicols}| outto the % \file{.toc} file but it worked wrong in some cases. So I~redefine the % internal \LaTeX\ macro instead. -% \CodeDefine\twocoltoc \CodeDefine\@starttoc \newcommand*\twocoltoc{% \RequirePackage{multicol}% \def\@starttoc##1{% @@ -1534,7 +2093,7 @@ % The macro given below is taken from the \pk{multicol} package (where % its name is |\enough@room|). I~put it in this package since I~needed % it in two totally different works. -%\CodeDefine\enoughpage +%\Define\enoughpage \newcommand\enoughpage[1]{% \par \dimen0=\pagegoal @@ -1542,19 +2101,19 @@ \ifdim\dimen0<#1\relax\newpage\fi} % Two shorthands for debugging: -%\CodeDefine\tOnLine\CodeDefine\OnAtLine +%\Define\tOnLine\Define\OnAtLine \newcommand*\tOnLine{\typeout{\on@line}} \let\OnAtLine\on@line % An equality sign properly spaced: -% \CodeDefine\equals\CodeDefine\eequals +% \Define\equals\Define\eequals \newcommand*\equals{${}={}$} % And for the \LaTeX's pseudo-code statements: \newcommand*\eequals{${}=={}$} % The job name without extension. -% \CodeDefine\jobnamewoe +% \Define\jobnamewoe \def\gm@jobn#1.#2\@@nil{#1} \def\jobnamewoe{\@xa\gm@jobn\jobname.\@@nil}% We add the dot @@ -1577,7 +2136,7 @@ % one, we |\let| it |\relax|. As the macro does lots and lots of % assignments, it shouldn't be used in |\edef|s. % -% \CodeDefine\freeze@actives +% \Define\freeze@actives % \changes{v0.76}{2007/02/07}{added} \def\freeze@actives{% @@ -1592,7 +2151,7 @@ % A~macro that typesets all 256 chars of given font. It makes use of -% |\@whilenum|. \CodeDefine\ShowFont +% |\@whilenum|. \Define\ShowFont \newcommand*\ShowFont[1][6]{% \begin{multicols}{#1}[The current font (the \f@encoding\ encoding):] @@ -1607,10 +2166,10 @@ % A~couple of macros for typesetting liturgic texts such as psalmody % of Liturgia Horarum. I~wrap them into a~declaration since they'll be % needed not every time. -% \CodeDefine\liturgiques +% \Define\liturgiques % \changes{v0.76}{07/3/30}{added, or rather moved from \file{Akatyst.tex}} \newcommand*\liturgiques[1][red]{% Requires the \pk{color} package. - \gmu@RP{color}% + \gmu@RPif{color}{color}% \newcommand*\czerwo{\small\color{#1}}% environment \newcommand{\czer}[1]{\leavevmode{\czerwo##1}}% we leave % vmode because if we don't, then \env{verse}'s |\everypar| would be @@ -1619,29 +2178,67 @@ \def\+{\czer{$\dag$}} \newcommand*\nieczer[1]{\textcolor{black}{##1}}} -% A~command that issues a~message urging to load a~package if it has -% not been loaded. -\let\gmu@RP\RequirePackage +% After the next definition you can write +% \cs{gmu@RP}\arg[options]\arg{package}\arg{csname} to get the package |#2| +% loaded with options |#1| if the csname |#3| is undefined. +\newcommand*\gmu@RPif[3][]{% + \ifx\relax#1\relax + \else \def\gmu@resa{[#1]}% + \fi + \@xa\RequirePackage\gmu@resa{#2}} -% \CodeDefine\gmu@RP +% Since inside \env{document} we cannot load a~package, we'll redefine +% |\gmu@RPif| to issue a~request before the error issued by undefined +% CS. +% \Define\gmu@RPif \AtBeginDocument{% - \renewcommand*\gmu@RP[2][]{% - \@ifpackageloaded{#2}{}{% - \typeout{^^J! Package `#2' not loaded!!! (\on@line)^^J}}}} + \renewcommand*\gmu@RPif[3][]{% + \@ifundefined{#3}{% + \@ifpackageloaded{#2}{}{% + \typeout{^^J! Package `#2' not loaded!!! (\on@line)^^J}}}{}}} % It's very strange to me but it seems that $\continuum$ is not % defined in the basic math packages. It is missing at least in the -% \textit{Symbols} book.\CodeDefine\continuum -\providecommand*\continuum{\gmu@RP{eufrak}\mathfrak{c}} +% \textit{Symbols} book.\Define\continuum +\providecommand*\continuum{\gmu@RPif{eufrak}{mathfrak}\mathfrak{c}} % And this macro I~saw in the \pk{ltugproc} document class nad I~liked % it. -\providecommand*\acro[1]{{\scshape\lowercase{#1}}} +\def\acro#1{\gmu@acroinner#1\gmu@acroinner} + +\def\gmu@acroinner#1{% + \ifx\gmu@acroinner#1\else + \ifcat a\@nx#1% + \ifnum`#1=\uccode`#1% + {\scshape\lowercase{#1}}% + \else{\smallerr#1}% + \fi + \else#1% + \fi + \afterfi\gmu@acroinner + \fi} + +% Since the fonts I~am currently using do not support required font +% feature, I~skip the following definition. +\iffalse +\newcommand*\acroff{% + \def\acro##1{{\addfontfeature{Letters=UppercaseSmallCaps}##1}}} +\fi \newcommand*\IMO{\acro{IMO}} \newcommand*\AKA{\acro{AKA}} +\newcommand*\qxenc{\fontencoding{QX}\selectfont} +% The |\copyright| command is unavailable in T1 and U~(unknown) +% encodings so provide +\newcommand*\qxcopyright{{\qxenc\copyright}} +\newcommand*\qxcopyrights{% + \let\gmu@copyright\copyright + \def\copyright{{\qxenc\gmu@copyright}}} + +\newcommand*\fixcopyright{% + \@ifXeTeX{\def\copyright{\char"00A9 }}{\qxcopyrights}} % Probably the only use of it is loading \pk{gmdocc.cls} `as second @@ -1656,8 +2253,234 @@ % the error message. +% Cf.\ \TeXbook exc. 11.6.\par +% A~line from \LaTeX: +% \[|% \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont|\] +% didn't work as I~would wish: in a~|\footnotesize|'s scope it still +% was |\scriptsize|, so too large. +% \changes{v0.81}{2007/05/13}{moved here from \pk{pmlectionis.cls}} + +%^^A% From my first love with infinite stretchabilities +%^^A~ \def\myvfil#1/{\vskip0pt plus#1fil\relax} +%^^A~ \def\myvfill#1/{\vskip0pt plus#1fill\relax} +%^^A~ \def\myhfil#1/{\hskip0pt plus#1fil\relax} +%^^A~ \def\myhfill#1/{\hskip0pt plus#1fill\relax} + +\def\dekfracc#1/#2{\leavevmode\kern.1em + \raise.5ex\hbox{\udigits\scriptsize#1}\kern-.1em + /\kern-.15em\lower.25ex\hbox{\udigits\scriptsize#2}} + + +\def\fnfracc#1/#2{\leavevmode\kern.1em + \raise.6ex\hbox{\udigits\tiny#1}\kern-.1em + /\kern-.1em\lower.25ex\hbox{\udigits\tiny#2}} +% \changes{v0.81}{2007/05/13}{moved here from \pk{pmlectionis.cls}} + + +% A~macro that acts like |\,| (thin and unbreakable space) except it +% allows hyphenation afterwards: + +\newcommand*\ikern{\,\penalty10000\hskip0sp\relax} +%\changes{v0.82}{2007/07/17}{added} + +% And a~macro to forbid hyphenation of the next word: +\newcommand*\nohy{\kern\z@} + + +% \subdivision{\cs{@ifempty}} + +\long\def\@ifempty#1#2#3{% + \def\gmu@reserveda{#1}% + \ifx\gmu@reserveda\@empty\afterfi{#2}% + \else\afterfi{#3}\fi +} + + + +% \subdivision{\cs{include} not only \file{.tex}'s} +% |\include| modified by me below lets you to include files of any +% extension provided that extension in the argument. +% +% If you want to |\include| a~non-\file{.tex} file and deal with it +% with |\includeonly|, give the latter command full file name, with +% the extension that is. +% +\def\gmu@getext#1.#2\@@nil{% + \def\gmu@filename{#1}% + \def\gmu@fileext{#2}} + +\def\include#1{\relax + \ifnum\@auxout=\@partaux + \@latex@error{\string\include\space cannot be nested}\@eha + \else \@include#1 \fi} + +\def\@include#1 {% + \gmu@getext#1.\@@nil + \ifx\gmu@fileext\empty\def\gmu@fileext{tex}\fi + \clearpage + \if@filesw + \immediate\write\@mainaux{\string\@input{\gmu@filename.aux}}% + \fi + \@tempswatrue + \if@partsw + \@tempswafalse + \edef\reserved@b{#1}% + \@for\reserved@a:=\@partlist\do{% + \ifx\reserved@a\reserved@b\@tempswatrue\fi}% + \fi + \if@tempswa + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux \gmu@filename.aux + \immediate\write\@partaux{\relax}% + \fi + \@input@{\gmu@filename.\gmu@fileext}% + \inclasthook + \clearpage + \@writeckpt{\gmu@filename}% + \if@filesw + \immediate\closeout\@partaux + \fi + \else +% If the file is not included, reset |\@include| |\deadcycles|, so that a +% long list of non-included files +% does not generate an `Output loop' error. + \deadcycles\z@ + \@nameuse{cp@\gmu@filename}% + \fi + \let\@auxout\@mainaux} + + +\newcommand\whenonly[3]{% + \def\gmu@whonly{#1,}% + \ifx\gmu@whonly\@partlist\afterfi{#2}\else\afterfi{#3}\fi} + +% I~assume one usually includes chapters or so so the last page style +% should be closing. +\def\inclasthook{\thispagestyle{closing}} + + + +% \subdivision{Faked small caps} + +\def\gmu@scapLetters#1{% + \ifx#1\relax\relax\else% two |\relax|es to cover the case of empty |#1|. + \ifcat a#1\relax + \ifnum\the\lccode`#1=`#1\relax + {\gmu@scsetup\MakeUppercase{#1}}% not Plain |\uppercase| + % because that works bad with \pk{inputenc}. + \else#1% + \fi + \else#1% + \fi% + \@xa\gmu@scapLetters + \fi}% +% +\def\gmu@scapSpaces#1 #2\@@nil{% + \ifx#1\relax\relax + \else\gmu@scapLetters#1\relax + \fi + \ifx#2\relax\relax + \else\afterfi{\ \gmu@scapSpaces#2\@@nil}% + \fi} +% +\def\gmu@scapss#1\@@nil{{\def~{{\nobreakspace}}% + \gmu@scapSpaces#1 \@@nil}}%|% \def\\{{\newline}}\relax| + % adding redefinition of |\\| caused + % stack overflow +% Note it disallows hyphenation except at |\-|. +\DeclareRobustCommand\fakescaps[2][\gmu@scalematchX]{{% + \let\gmu@scsetup=#1\gmu@scapss#2\@@nil}} + +% Experimente z~akcentami patrz no3.tex. +\def\tinycae{{\tiny\AE}}% to use in |\fakescaps[\tiny]{...}| + +\RequirePackage{calc} + +% wg |\zf@calc@scale| pakietu \pk{fontspec}. + +\@ifXeTeX{% + \def\gmu@scalematchX{% + \begingroup + \ifx\zf@scale\empty\def\gmu@scalar{1.0}% + \else\let\gmu@scalar\zf@scale\fi + \setlength\@tempdima{\fontdimen5\font}% 5---ex height + \setlength\@tempdimb{\fontdimen8\font}% 8---\XeTeX\ synthesized + % uppercase height. + \divide\@tempdimb by1000\relax + \divide\@tempdima by\@tempdimb + \setlength{\@tempdima}{\@tempdima*\real{\gmu@scalar}}% + \@ifundefined{fakesc@extrascale}{}{% + \setlength{\@tempdima}{\@tempdima*\real{\fakesc@extrascale}}}% + \@tempcnta=\@tempdima + \divide\@tempcnta by 1000\relax + \@tempcntb=-1000\relax + \multiply\@tempcntb by\@tempcnta + \advance\@tempcntb by\@tempdima + \xdef\gmu@scscale{\the\@tempcnta.% + \ifnum\@tempcntb<100 0\fi + \ifnum\@tempcntb<10 0\fi + \the\@tempcntb}%^^A{\strip@pt\@tempdimc}% +%^^A \typeout{**** \gmu@scscale}% + \endgroup + \addfontfeature{Scale=\gmu@scscale}% + }}{\let\gmu@scalematchX\smallerr} + +\def\fakescextrascale#1{\def\fakesc@extrascale{#1}} + + +% \subdivision{See above/see below} +% To generate a~phrase as in the header depending of whether the +% respective label is before of after. +\newcommand*\wyzejnizej[1]{% + \edef\gmu@tempa{\@ifundefined{r@#1}{\arabic{page}}{% + \@xa\@xa\@xa\@secondoftwo\csname r@#1\endcsname}}% + \ifnum\gmu@tempa<\arabic{page}\relax wy\.zej\fi + \ifnum\gmu@tempa>\arabic{page}\relax ni\.zej\fi + \ifnum\gmu@tempa=\arabic{page}\relax \@xa\ignorespaces\fi +} + + +%\subdivision{\env{luzniej} and \env{napapierki}---environments ^^B +% used in page breaking for money} +% +% The name of first of them comes from Polish typesetters' phrase +% ``rozbija\cacute\ [sk\l ad] na papierki''---`to broaden [leading] with +% paper scratches'. + +\def\napapierkistretch{0,3pt}% It's quite much for 11/13pt typesetting + +\newenvironment*{napapierki}{% + \par\global\advance\baselineskip% + by 0ptplus\napapierkistretch\relax}{% + \par\dimen\z@=\baselineskip + \global\baselineskip=\dimen\z@}% so that you can use |\endnapapierki| + % in interlacing environments + + +\newenvironment*{luzniej}[1][1]{% + \multiply\tolerance by 2\relax + \looseness=#1\relax}{\par} + + +% The original |\pauza| of \pk{polski} has the skips rigid (one is even +% a~kern). It begins with |\ifhmode| to be usable also at the +% beginning of a~line as the mark of a~dialogue. +% \Define\pauza\Define\pauzacore\Define\shortpauza +\AtBeginDocument{% to be independent of moment of loading of \pk{polski}. + \DeclareRobustCommand*\pauza{% + \ifhmode\unskip\penalty10000\hskip0.2em plus0.1em\relax\fi + \pauzacore\hskip.2em plus0.1em\ignorespaces}} + +\def\pauzacore{---} +\def\shortpauza{% + \def\pauzacore{--\kern,23em\relax\llap{--}}} + + \endinput % +% \ChangesGeneral +% % \changes{v0.70}{06/10/20}{Package renamed to \pk{gmutils} from % \pk{gmlpatch}. As my \protect\TeX\ Guru remarked rightly, the % previous name might suggest there was sth.\ wrong with \LaTeX\ which @@ -1674,13 +2497,17 @@ % prints them very tight} % % \changes{v0.77}{2007/04/13}{\cs{afterfi} \& pals made two-argument -% as the Marcin Woli\'nski's analogoi are. At this occasion some +% as the Marcin Woli\nacute ski's analogoi are. At this occasion some % redundant macros of that family are deleted} % % \changes{v0.78}{2007/04/26}{\cs{@namelet} renamed to \cs{n@melet} % to solve a~conflict with the \pk{beamer} class. The package contents % regrouped} % +% \changes{v0.85}{2007/11/16}{fixed behaviour of too clever headings +% with \pk{gmdoc} by adding an \cs{ifdim} test} +% +% % \PrintChanges\PrintIndex %\NoEOF -- cgit v1.2.3