From ed627af9ac01852762186267a2a6e6c945b2d810 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 8 Oct 2008 00:30:50 +0000 Subject: gmutils 0.94 (7oct08) git-svn-id: svn://tug.org/texlive/trunk@10882 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gmutils/gmutils.sty | 1232 ++++++++++++++--------- 1 file changed, 759 insertions(+), 473 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 5182082a4dd..0736669b416 100644 --- a/Master/texmf-dist/tex/latex/gmutils/gmutils.sty +++ b/Master/texmf-dist/tex/latex/gmutils/gmutils.sty @@ -20,7 +20,7 @@ %% %% LPPL status: "author-maintained".\par %% -%% Many thanks to my \TeX\ Guru Marcin Woli\'nski for his \TeX nical ^^A +%% Many thanks to my \TeX\ Guru Marcin Woliński for his \TeX nical ^^A %% support. % %\end{copyrnote} @@ -53,6 +53,7 @@ % \chschange{v0.92}{2008/8/11}{4133} % \chschange{v0.93}{2008/8/21}{4140} % \chschange{v0.93}{2008/8/30}{4501} +% \chschange{v0.94}{2008/10/4}{4869} % % % \skiplines we skip the driver @@ -81,7 +82,7 @@ pagella, fontspec=quiet]{gmdocc} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmutils} - [2008/08/30 v0.93 some rather TeXnical macros, some of them tricky (GM)] + [2008/10/03 v0.94 some rather TeXnical macros, some of them tricky (GM)] % % \tableofcontents @@ -169,7 +170,7 @@ pagella, fontspec=quiet]{gmdocc} % -% \subdivision{A~couple of abbreviations} +% \division{A~couple of abbreviations} % {\DoIndex{\@nx \@xa} \Define\@xa \Define\@nx \let\@xa\expandafter \let\@nx\noexpand @@ -220,7 +221,7 @@ pagella, fontspec=quiet]{gmdocc} \long\def\@nameedef#1#2{% \changes{v0.93}{2008/08/30}{added} \@xa\edef\csname#1\endcsname{#2}} -% \subdivision{\cs{firstofone} and the queer \cs{catcode}s} +% \division{\cs{firstofone} and the queer \cs{catcode}s} % % Remember that once a~macro's argument has been read, its % |\catcode|s are assigned forever and ever. That's what is @@ -232,17 +233,17 @@ pagella, fontspec=quiet]{gmdocc} \long\def\firstofone#1{#1} % The next command, |\foone|, is intended as two-argument for -% shortening of the |\bgroup...\firstofone{\egroup...}| hack. +% shortening of the |\begingroup...\firstofone{\endgroup...}| hack. % -\long\def\foone#1{\bgroup#1\egroupfirstofone} +\long\def\foone#1{\begingroup#1\egfirstofone} % \UnDef -\long\def\egroupfirstofone#1{\egroup#1} +\long\def\egfirstofone#1{\endgroup#1} \long\def\fooatletter{\foone\makeatletter} -% \subdivision{Global Boolean switches} +% \division{Global Boolean switches} % % The |\newgif| declaration's effect is used even in the \LaTeXe\ % source by redefining some particular user defined ifs (UD-ifs @@ -366,8 +367,9 @@ pagella, fontspec=quiet]{gmdocc} \let\addtomacro=\addto@macro % 2008/08/09 I~need to prepend something not add at the end---so -\long\def\prependtomacro#1#2{% - \edef#2{\unexpanded{#1}\@xa\unexpanded\@xa{#2}}} +\long\def\prependtomacro#1#2{% \changes{v0.94}{2008/09/15}{order of + % arguments reversed} + \edef#1{\unexpanded{#2}\@xa\unexpanded\@xa{#1}}} % Note that \cs{prependtomacro} can be prefixed. % \Define\addtotoks @@ -392,34 +394,278 @@ pagella, fontspec=quiet]{gmdocc} \newcommand*\g@relaxen{\global\@relaxen} \@ifdefinable\grelaxen{\let\grelaxen\g@relaxen} -% \subdivision{Apmpulex Compressa-like modifications of macros} + +%\division{From the ancient \pk{xparse} of \TeX Live 2007} +% The code of this section is rewritten contents of the \pk{xparse} +% package version 0.17 dated 1999/09/10, the version available in \TeX +% Live 2007-13, in Ubuntu packages at least. It's a~stub `im Erwartung' +% (Schönberg) for the \LaTeX 3 bundle and it does what I~want, namely +% defines |\DeclareDocumentCommand|. I~rewrote the code to use the usual +% catcodes (only with |@| a~letter) and not to use the \pk{ldcsetup} +% package (which caused an error of +% undefined \CS |\KV@def|). + +\newtoks\@temptokenb +\newtoks\xparsed@args +\long\def\DeclareDocumentCommand#1#2#3{% + \@tempcnta\z@ + \toks@{}% + \@temptokena\toks@ + \@temptokenb\toks@ + \@ddc#2X\edef#1{% + \noexpand\@ddc@ + {\the\toks@}% + \@xa\noexpand\csname\string#1\endcsname + \noexpand#1% + }% + \long\@xa\def\csname\string#1\@xa\endcsname + \the\@temptokena{#3}} + +\long\def\DeclareDocumentEnvironment#1#2#3#4{% + \@xa\DeclareDocumentCommand\csname#1\endcsname{#2}{% + \xparsed@args\toks@ + #3}% + \@xa\let\csname end#1\endcsname\@parsed@endenv + \long\@xa\def\csname end\string\\#1\@xa\endcsname + \the\@temptokena{#4}} + +\def\@parsed@endenv{% + \@xa\@parsed@endenv@\the\xparsed@args} + +\def\@parsed@endenv@#1{% + \csname end\string#1\endcsname} + +\def\@ddc@#1#2#3{% + \ifx\protect\@typeset@protect + \@xa\@firstofone + \else + \protect#3\@xa\@gobble + \fi + {\toks@{#2}#1\the\toks@}} + +\def\@ddc#1{% + \ifx#1X% + \else + \ifx#1m% + \addto@hook\@temptokenb m% + \else + \toks@\@xa{% + \the\@xa\toks@ + \csname @ddc@\the\@temptokenb\@xa\endcsname + \csname @ddc@#1\endcsname}% + \@temptokenb{}% + \fi + \advance\@tempcnta\@ne + \@temptokena\@xa{% + \the\@xa\@temptokena\@xa##\the\@tempcnta}% + \@xa + \@ddc + \fi} + +\long\def\@ddc@s#1\toks@{% + \@ifstar + {\addto@hook\toks@\BooleanTrue#1\toks@}% + {\addto@hook\toks@\BooleanFalse#1\toks@}} + +\long\def\@ddc@m#1\toks@#2{% + \addto@hook\toks@{{#2}}#1\toks@}% + +\long\def\@ddc@o#1\toks@{% + \@ifnextchar[%^^A] + {\@ddc@o@{#1}} + {\addto@hook\toks@\NoValue#1\toks@}} + +\long\def\@ddc@o@#1[#2]{% + \addto@hook\toks@{{#2}}#1\toks@} + +\def\@ddc#1{% + \ifx#1X% + \perhaps@grab@ms + \else + \ifx#1m% + \addto@hook\@temptokenb m% + \else + \toks@\@xa{% + \the\@xa\toks@ + \csname @ddc@x\the\@temptokenb\@xa\endcsname + \csname @ddc@#1\endcsname}% + \@temptokenb{}% + \ifx#1O% + \let\next@ddc\grab@default + \else + \ifx#1C% + \let\next@ddc\grab@default + \fi + \fi + \fi + \advance\@tempcnta\@ne + \@temptokena\@xa{% + \the\@xa\@temptokena\@xa##\the\@tempcnta}% + \@xa + \next@ddc + \fi +}% + +\let\next@ddc\@ddc +\def\grab@default#1{% + \toks@\@xa{% + \the\toks@ + {#1}}% + \let\next@ddc\@ddc + \@ddc +} + +\long\def\@ddc@O#1#2\toks@{% + \@ifnextchar[%^^A] + {\@ddc@o@{#2}}% + {\addto@hook\toks@{{#1}}#2\toks@}} + +\long\def\@ddc@c#1\toks@{% + \@ifnextchar(%^^A) + {\@ddc@c@#1}% + {\PackageError{xparse}{Missing~coordinate~argument}% + {A~value~of~(0,0)~is~assumed}% + \addto@hook\toks@{{00}}#1\toks@}% +} + +\long\def\@ddc@c@#1(#2,#3){% + \addto@hook\toks@{{{#2}{#3}}}#1\toks@} + +\long\def\@ddc@C#1#2\toks@{% + \@ifnextchar(%^^A) + {\@ddc@c@#2}% + {\addto@hook\toks@{{#1}}#2\toks@}} + +\let\perhaps@grab@ms\relax +\def\grab@ms{% + \toks@\@xa{% + \the\@xa\toks@ + \csname @ddc@x\the\@temptokenb\endcsname + }} + +\let\@ddc@m\undefined +\long\def\@ddc@xm#1\toks@#2{% + \addto@hook\toks@{{#2}}#1\toks@} + +\long\def\@ddc@xmm#1\toks@#2#3{% + \addto@hook\toks@{{#2}{#3}}#1\toks@} + +\long\def\@ddc@xmmm#1\toks@#2#3#4{% + \addto@hook\toks@{{#2}{#3}{#4}}#1\toks@} + +\long\def\@ddc@xmmmm#1\toks@#2#3#4#5{% + \addto@hook\toks@{{#2}{#3}{#4}{#5}}#1\toks@} + +\long\def\@ddc@xmmmmm#1\toks@#2#3#4#5#6{% + \addto@hook\toks@{{#2}{#3}{#4}{#5}{#6}}#1\toks@} +\long\def\@ddc@xmmmmmm#1\toks@#2#3#4#5#6#7{% + \addto@hook\toks@{{#2}{#3}{#4}{#5}{#6}{#7}}#1\toks@} +\long\def\@ddc@xmmmmmmm#1\toks@#2#3#4#5#6#7#8{% + \addto@hook\toks@{{#2}{#3}{#4}{#5}{#6}{#7}{#8}}#1\toks@} +\long\def\@ddc@xmmmmmmmm#1\toks@#2#3#4#5#6#7#8#9{% + \addto@hook\toks@{{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}#1\toks@} +\long\def\@ddc@xmmmmmmmmm\the\toks@#1#2#3#4#5#6#7#8#9{% + \addto@hook\toks@{{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}\the\toks@} +\let\@ddc@x\relax + +\long\def\DeclareDocumentEnvironment#1#2#3#4{% +\@xa\DeclareDocumentCommand\csname#1\endcsname{#2}{% + #3}% +\@namedef{end#1}{#4}% +} +\let\@parsed@endenv\undefined +\let\@parsed@endenv@\undefined +\def\IfSomethingTF#1{\def\something@in{#1}\If@SomethingTF} +\def\IfSomethingT#1#2#3{\def\something@in{#1}% + \If@SomethingTF{#2}{#3}\@empty} + +\def\IfSomethingF#1#2#3{\def\something@in{#1}% + \If@SomethingTF{#2}\@empty{#3}} + +\def\If@SomethingTF#1{% + \def\something@tmp{#1}% + \ifx\something@tmp\something@in + \@xa\@secondofthree + \else + \@xa\def\@xa\something@tmpb\@xa{#1}% + \ifx\something@tmp\something@tmpb + \@xa\@xa\@xa\@thirdofthree + \else + \@xa\@xa\@xa\@firstofone + \fi + \fi + {\@xa\If@SomethingTF\@xa{#1}}% +} + +\long\def\@secondofthree#1#2#3{#2} +\long\def\@thirdofthree#1#2#3{#3} +\def\NoValue{-NoValue-} +\def\NoValueInIt{\NoValue} +\def\IfNoValueTF{\IfSomethingTF\NoValue} +\def\IfNoValueT{\IfSomethingT\NoValue} +\def\IfNoValueF{\IfSomethingF\NoValue} +\def\IfValueTF#1#2#3{\IfNoValueTF{#1}{#3}{#2}} +\let\IfValueT\IfNoValueF +\let\IfValueF\IfNoValueT +\def\BooleanFalse{TF} +\def\BooleanTrue{TT} +\def\IfBooleanTF#1{% + \if#1% + \@xa\@firstoftwo + \else + \@xa\@secondoftwo + \fi +} + +\def\IfBooleanT#1#2{% + \IfBooleanTF{#1}{#2}\@empty +} + +\def\IfBooleanF#1{% + \IfBooleanTF{#1}\@empty +} + + +% \division{Ampulex Compressa-like modifications of macros} % Ampulex Compressa is a~wasp that performs brain surgery on its % victim cockroach to lead it to its lair and keep alive for its % larva. Well, all we do here with the internal \LaTeX\ macros % resembles Ampulex's actions but here is a~tool for a~replacement of % part of macro's definition. % -% The \cs{ampulexdef} command takes its |#2| which has to be a~macro -% and replaces part of its definition (delimited with |#3| and |#4|) +% The \cs{ampulexdef} command takes its |#4| which has to be a~macro +% and replaces part of its definition (delimited with |#5| and |#6|) % with the replacement |#5|. The redefinition may be prefixed with -% |#1|. |#2| may have parameters and for such a~macro you have to set -% the parameters string and arguments string with the \cs{ampulexset} +% |#1|. |#4| may have parameters and for such a~macro you have to set +% the parameters string and arguments string with the \cs{ampulexset} % declaration. If \cs{ampulexdef} doesn't find the sart and end tokens -% in the meaning of the macro, it does nothing to it. For an example +% in the meaning of the macro, it does nothing to it. |#2| and |#3| +% are parameters' strings for \cs{def} and for eating by first-level +% expansion. You have to write |####| instead of |#| or you can use +% |\ampulexhash| as well. For an example % use see line \ref{ampulexset}. -\newcommand\ampulexdef[5][\relax]{%^^B +%^^A\RequirePackage{xparse} + +%^^A\long\def\gobblefour#1#2#3#4{} + +\DeclareDocumentCommand\ampulexdef{O{}mO{}O{}mmm}{%^^B % \begin{enumargs} - % \item definition prefix, + % \item definition prefix, empty by default, % \item macro to be redefined, + % \item \cs{def} parameters string, empty by default, + % \item definition body parameters for the first expansion, empty by default, % \item start token(s), % \item end token(s) % \item replacement. % \end{enumargs} % \changes{v0.93}{2008/08/29}{added} - \def\gmu@tempa{#3}% - \def\gmu@tempb{#4}% - \def\gmu@tempc{#5}% we wrap the start, end and replacement tokens in + % \changes{v0.94}{2008/09/07}{made \pk{xparse}-ish and + % \cs{ampulexset} removed} + % For the example of usage see \ref{ampulexset}. + \def\gmu@tempa{#5}% + \def\gmu@tempb{#6}% + \def\gmu@tempc{#7}% we wrap the start, end and replacement tokens in % macros to avoid unbalanced \incs{if}s. \edef\gmu@tempd{% \long\def\@nx\gmu@tempd @@ -452,32 +698,27 @@ pagella, fontspec=quiet]{gmdocc} \@nx\@xa{\@nx\gmu@tempc}%we replace the part of the redefined % macro's meaning with the replacement text. \@nx\unexpanded{####3}}}% +%^^A\show\gmu@tempd \gmu@tempd +%^^A\show\gmu@tempd % + \edef\gmu@tempf{#4}% \edef\gmu@tempe{% - #1\def\@nx#2\gmu@ampulexpa{% - \@xa\@xa\@xa\gmu@tempd\@xa#2\gmu@ampulexpb - \ampulexdef}}% + #1\def\@nx#2#3{% + \@xa\@xa\@xa\gmu@tempd\@xa#2\gmu@tempf\ampulexdef}}% \gmu@tempe \fi} - -\long\def\ampulexset#1#2{% - \def\gmu@ampulexpa{#1}% it's the parameter string for definition - \def\gmu@ampulexpb{#2}% it's the arguments string for the first - % expansion. For the example of usage see \ref{ampulexset}. -} - -\ampulexset{}{} +\def\ampulexhash{####}% for your convenience (not to count the hashes). % For the heavy debugs I~was doing while preparing \pk{gmdoc}, as % a~last resort I~used |\showlists|. But this command alone was % usually too little: usually it needed setting |\showboxdepth| and % |\showboxbreadth| to some positive values. So, % -% \Define\gmshowlists -% \changes{v0.59}{06/09/04}{moved here from \pk{gmdoc}} +%^^A \Define\gmshowlists \def\gmshowlists{\showboxdepth=1000 \showboxbreadth=1000 \showlists} +% \changes{v0.59}{06/09/04}{moved here from \pk{gmdoc}} \newcommand\nameshow[1]{\@xa\show\csname#1\endcsname} @@ -656,7 +897,8 @@ pagella, fontspec=quiet]{gmdocc} \long\def\afterfi#1#2\fi{\fi#1} % And two more of that family: \long\def\afterfifi#1#2\fi#3\fi{\fi\fi#1} -\long\def\afteriffifi#1#2\if#3\fi#4\fi{\fi#1} +% \changes{v0.94}{2008/09/09}{\cs{if} removed from parameters' string} +\long\def\afteriffifi#1#2\fi#3\fi{\fi#1} % Notice the refined elegance of those macros, that cover both `then' % and `else' cases thanks to |#2| that is discarded. @@ -664,6 +906,32 @@ pagella, fontspec=quiet]{gmdocc} \long\def\afteriffififi#1#2\fi#3\fi#4\fi{\fi\fi#1} \long\def\afterfififi#1#2\fi#3\fi#4\fi{\fi\fi\fi#1} +% \division{\cs{gm@ifundefined}---a~test that doesn't create any\ +% hash entry unlike \cs{@ifundefined}} + +% I~define it under another name not redefine |\@ifundefined| because +% I~can imagine an odd case when something works thanks to +% |\@ifundefined|'s `relaxation effect'. + +\long\def\gm@ifundefined#1{% + % \changes{v0.94}{2008/9/12}{added. All \cs{@ifundefined}s used by + % me changed to this} + % \changes{v0.94}{2008/10/03}{made robust to unbalanced \cs{if}s and + % \cs{fi}s the same way as \LaTeX's \cs{@ifundefined} (after a~heavy + % debug :-)} + \ifcsname#1\endcsname% defined + \@xa\ifx\csname #1\endcsname\relax% but as |\relax| + \afterfifi\@firstoftwo% + \else% defined and not |\relax| + \afterfifi\@secondoftwo% + \fi + \else% not defined + \afterfi\@firstoftwo% + \fi} + + + + % \division{Environments redefined} % \subdivision{Almost an environment or redefinition of \cs{begin}} % @@ -706,17 +974,10 @@ pagella, fontspec=quiet]{gmdocc} % corresponding control sequence hasn't been known to \TeX, this line % will act as |\relax|.) -% For back compatibility with my earlier works -% \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|. +% Let us make it the starred version of |\begin|. % \begin{DoIndex}{\begin} % \Define\begin - % \Define*\begin* +% \Define*\begin* \def\begin{\@ifstar{\@begnamedgroup}{% \@begnamedgroup@ifcs}} % \end{DoIndex} @@ -1125,13 +1386,13 @@ pagella, fontspec=quiet]{gmdocc} %\changes{v0.61}{06/09/05}{added.} %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} \pdef\StoreMacro{% - \bgroup\makeatletter\@ifstar\egStore@MacroSt\egStore@Macro} + \begingroup\makeatletter\@ifstar\egStore@MacroSt\egStore@Macro} % The unstarred version takes a~\CS and the starred version % a~text, which is intended for special control sequences. For storing % environments there is a~special command in line \ref{StoreEnvironment}. -\long\def\egStore@Macro#1{\egroup\Store@Macro{#1}} -\long\def\egStore@MacroSt#1{\egroup\Store@MacroSt{#1}} +\long\def\egStore@Macro#1{\endgroup\Store@Macro{#1}} +\long\def\egStore@MacroSt#1{\endgroup\Store@MacroSt{#1}} \long\def\Store@Macro#1{% \escapechar92 @@ -1167,8 +1428,8 @@ pagella, fontspec=quiet]{gmdocc} % them. The \CS may be separated with commas but they don't have to. % \Define\StoreMacros -\long\pdef\StoreMacros{\bgroup\makeatletter\Store@Macros} -\long\def\Store@Macros#1{\egroup +\long\pdef\StoreMacros{\begingroup\makeatletter\Store@Macros} +\long\def\Store@Macros#1{\endgroup \gmu@setsetSMglobal \let\gml@StoreCS\Store@Macro \gml@storemacros#1.} @@ -1205,10 +1466,10 @@ pagella, fontspec=quiet]{gmdocc} %\changes{v0.61}{06/09/05}{added.} %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} \pdef\RestoreMacro{% - \bgroup\makeatletter\@ifstar\egRestore@MacroSt\egRestore@Macro} + \begingroup\makeatletter\@ifstar\egRestore@MacroSt\egRestore@Macro} -\long\def\egRestore@Macro#1{\egroup\Restore@Macro{#1}} -\long\def\egRestore@MacroSt#1{\egroup\Restore@MacroSt{#1}} +\long\def\egRestore@Macro#1{\endgroup\Restore@Macro{#1}} +\long\def\egRestore@MacroSt#1{\endgroup\Restore@MacroSt{#1}} \long\def\Restore@Macro#1{% \escapechar92 @@ -1226,9 +1487,9 @@ pagella, fontspec=quiet]{gmdocc} \global\gmu@SMglobalfalse} % \Define\RestoreMacros -\long\pdef\RestoreMacros{\bgroup\makeatletter\Restore@Macros} +\long\pdef\RestoreMacros{\begingroup\makeatletter\Restore@Macros} -\long\def\Restore@Macros#1{\egroup +\long\def\Restore@Macros#1{\endgroup \gmu@setsetSMglobal \let\gml@StoreCS\Restore@Macro% \gmhypertarget[letRestore]{we} % direct the core \CS towards restoring and call the same iterating @@ -1239,8 +1500,8 @@ pagella, fontspec=quiet]{gmdocc} % And to restore \emph{and} use immediately: %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} -\def\StoredMacro{\bgroup\makeatletter\Stored@Macro} -\long\def\Stored@Macro#1{\egroup\Restore@Macro#1#1} +\def\StoredMacro{\begingroup\makeatletter\Stored@Macro} +\long\def\Stored@Macro#1{\endgroup\Restore@Macro#1#1} % To be able to call a~stored \CS without restoring it. \def\storedcsname#1{%% \changes{v0.88}{2008/08/03}{added} @@ -1370,12 +1631,14 @@ pagella, fontspec=quiet]{gmdocc} \def\gmu@nocite@ampulex{% we wrap the stuff in a~macro to hide an open % \incs{if}. And not to make the begin-input hook not too large. - \ampulexset{########1}{{####1}}% \label{ampulexset} the first is the + % \label{ampulexset} the first is the % parameters string and the second the argument for one-level % expansion of \incs{nocite} so it has to consist of two times less % hashes than the first. Both hash strings are doubled to pass the % first \incs{def}. - \ampulexdef\nocite\ifx + \ampulexdef[]\nocite[####1][{{####1}}]% note the double brace + % around \inverb|#3|. + \ifx {\@onlypreamble\document}% \iftrue} @@ -1422,44 +1685,6 @@ pagella, fontspec=quiet]{gmdocc} \newcommand*\HimHer{\gm@atppron{Him}{Her}} \newcommand*\HisHers{\gm@atppron{His}{Hers}} -%^^A % \division[To Save Precious Count Registers]{\gmhypertarget{To Save Precious Count Registers}} -%^^A % -%^^A % It's a~contribution to \TeX's ecology \gobble(;-). You can use as -%^^A % many \CSs as you wish and you may use only 256 count registers -%^^A % (although in \eTeX\ there are $2^{16}$ count registers, which makes -%^^A % the following a~bit obsolete). -%^^A -%^^A \newcommand*\nummacro[1]{\gdef#1{0}} -%^^A -%^^A \newcommand*\stepnummacro[1]{% -%^^A \@tempcnta=#1\relax -%^^A \advance\@tempcnta by1\relax -%^^A \xdef#1{\the\@tempcnta}}% Because of some mysterious reasons -%^^A % explicit |\count0| interferred with page -%^^A % numbering when used in |\gmd@evpaddonce| in \pk{gmdoc}. -%^^A -%^^A -%^^A -%^^A \newcommand*\addtonummacro[2]{% -%^^A \count0=#1\relax -%^^A \advance\count0by#2\relax -%^^A \xdef#1{\the\count\z@}} -%^^A % Need an explanation? The |\nummacro| declaration defines its -%^^A % argument (that should be a~\CS) as |{0}| which is analogous to -%^^A % |\newcount| declaration but doesn't use up any count register. -%^^A % -%^^A % Then you may use this numeric macro as something between \TeX's -%^^A % count \CS and \LaTeX's counter. The macros |\stepnummacro| and -%^^A % |\addtonummacro| are analogous to \LaTeX's |\stepcounter| and -%^^A % |\addtocounter| respectively: |\stepnummacro| advances the number -%^^A % stored in its argument by 1 and |\addtonummacro| advances it by the -%^^A % second argument. As the \LaTeX's analogoi, they have the global effect -%^^A % (the effect of global warming \gobble(;-)\,). -%^^A % -%^^A % So far I've used only |\nummacro| and |\stepnummacro|. Notify me if -%^^A % you use them and whether you need sth.\ more, |\multiplynummacro| -%^^A % e.g. -%^^A % % \division{Improvements to \pk{mwcls} sectioning commands} % @@ -1506,37 +1731,40 @@ pagella, fontspec=quiet]{gmdocc} % But let's make a~shorthand for this test since we'll use it three % times in this package and maybe also somewhere else. % \Define\@ifnotmw -\long\def\@ifnotmw#1#2{\@ifundefined{mw@sectionxx}{#1}{#2}} - -\let\gmu@def\def -\@ifnotmw{% - \StoreMacro\gmu@def \def\gmu@def#14#2{\RestoreMacro\gmu@def}}{} -% I~know it may be of bad taste (to write such a~way \emph{here}) but -% I~feel so lonely and am in an alien state of mind after 3 hour sleep -% last night and, worst of all, listening to sir Edward Elgar's flamboyant -% Symphonies d'Art Nouveau. -% -% A~\emph{decent} person would just wrap the following -% definition in |\@ifundefined|'s Else. But look, the definition is so -% long and I~feel so lonely etc. So, -% I~define |\def| (for some people there's nothing sacred) to be -% a~macro with two parameters, first of which is -% delimited by digit 4 (the last token of |\mw@sectionxx|'s parameter -% string) and the latter is undelimited which means it'll be the body -% of the definition. Such defined |\def| does nothing else but -% restores its primitive meaning by the way sending its arguments to -% the Gobbled Tokens' Paradise. Luckily, |\RestoreMacro| contains -% |\let| not |\def|. +\long\def\@ifnotmw#1#2{\gm@ifundefined{mw@sectionxx}{#1}{#2}} + + + +%^^A \let\gmu@def\def +%^^A \@ifnotmw{% +%^^A \StoreMacro\gmu@def \def\gmu@def#14#2{\RestoreMacro\gmu@def}}{} +%^^A % I~know it may be of bad taste (to write such a~way \emph{here}) but +%^^A % I~feel so lonely and am in an alien state of mind after 3 hour sleep +%^^A % last night and, worst of all, listening to sir Edward Elgar's flamboyant +%^^A % Symphonies d'Art Nouveau. +%^^A % +%^^A % A~\emph{decent} person would just wrap the following +%^^A % definition in |\gm@ifundefined|'s Else. But look, the definition is so +%^^A % long and I~feel so lonely etc. So, +%^^A % I~define |\def| (for some people there's nothing sacred) to be +%^^A % a~macro with two parameters, first of which is +%^^A % delimited by digit 4 (the last token of |\mw@sectionxx|'s parameter +%^^A % string) and the latter is undelimited which means it'll be the body +%^^A % of the definition. Such defined |\def| does nothing else but +%^^A % restores its primitive meaning by the way sending its arguments to +%^^A % the Gobbled Tokens' Paradise. Luckily, |\RestoreMacro| contains +%^^A % |\let| not |\def|. % The kernel of MW's sectioning commands: -\gmu@def\mw@sectionxx#1#2[#3]#4{% +\@ifnotmw{}{% +\def\mw@sectionxx#1#2[#3]#4{% \edef\mw@HeadingLevel{\csname #1@level\endcsname \space}% space delimits level number! \ifHeadingNumbered \ifnum \mw@HeadingLevel>\c@secnumdepth \HeadingNumberedfalse \fi - % line below is in \@ifundefined to make it work in classes - % other than mwbk - \@ifundefined{if@mainmatter}{}{\gm@dontnumbersectionsoutofmainmatter} + % \nostanza line below is in |\gm@ifundefined| to make it work in classes + % other than \pk{mwbk}\nostanza + \gm@ifundefined{if@mainmatter}{}{\gm@dontnumbersectionsoutofmainmatter} \fi %\begin{verbatim} %% \ifHeadingNumbered @@ -1552,7 +1780,7 @@ pagella, fontspec=quiet]{gmdocc} \def\mw@HeadingType{#1}% \if\mw@HeadingBreakBefore \if@specialpage\else\thispagestyle{closing}\fi - \@ifundefined{if@openright}{}{\gm@clearpagesduetoopenright}% + \gm@ifundefined{if@openright}{}{\gm@clearpagesduetoopenright}% \if\mw@HeadingBreakAfter \thispagestyle{blank}\else \thispagestyle{opening}\fi @@ -1598,6 +1826,7 @@ pagella, fontspec=quiet]{gmdocc} } %^^A%%% (End of Experimente with MW sectioning.) + % % \subdivision{An improvement of MW's \cs{SetSectionFormatting}} % @@ -1620,20 +1849,20 @@ pagella, fontspec=quiet]{gmdocc} \relaxen\SetSectionFormatting \newcommand*\SetSectionFormatting[5][\empty]{% - \ifx\empty#1\relax\else% empty (not |\empty|!) |#1| also launches |\else|. + \ifx\empty#1\relax\else% empty (not |\empty|!) |#1| also launches |\else|.\HideDef \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}}}{}% + \gm@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}% + \else\mw@setflags{#2}% \ResumeDef \fi} \def\mw@secdef#1#2#3#4{% ^^B @@ -1648,7 +1877,7 @@ pagella, fontspec=quiet]{gmdocc} {\@namedef{#1#2}{#3}}} \def\mw@secundef#1#2{% - \@ifundefined{#1}{% + \gm@ifundefined{#1}{% \ClassError{mwcls/gm}{% command \bslash#1 undefined \MessageBreak after \bslash SetSectionFormatting!!!\MessageBreak}{% @@ -1659,13 +1888,13 @@ pagella, fontspec=quiet]{gmdocc} % 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@}% + \edef\gmu@reserveda{\unexpanded{#2}\@xa\unexpanded{\gmu@reserveda}}% \n@melet{#1@head}{gmu@reserveda}% %^^A \@xa\show\csname#1@head\endcsname } +}% of |\@ifnotmw|'s else. + % \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 @@ -1703,12 +1932,12 @@ pagella, fontspec=quiet]{gmdocc} % two-header-skip. (We put the macro defined below just before % |\addvspace| in \pk{mwcls} inner macros.) \def\gmu@checkaftersec{% - \@ifundefined{gmu@prevsec}{}{% + \gm@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}% + \glet\gmu@reserveda\mw@HeadingBreakAfter}% \UnDef \if\mw@HeadingBreakBefore\def\gmu@reserveda{11}\fi% if the % current heading inserts page break before itself, all the play % with vskips is irrelevant. @@ -1716,7 +1945,7 @@ pagella, fontspec=quiet]{gmdocc} \penalty10000\relax \skip\z@=\csname\gmu@prevsec @postskip\endcsname\relax \skip\tw@=\csname\mw@HeadingType @preskip\endcsname\relax - \@ifundefined{\mw@HeadingType @twoheadskip}{ + \gm@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 @@ -1737,7 +1966,7 @@ pagella, fontspec=quiet]{gmdocc} \penalty10000 \fi \fi - }% of |\@ifundefined{gmu@prevsec}| `else'. + }% of |\gm@ifundefined{gmu@prevsec}| `else'. }% of |\def\gmu@checkaftersec|. \def\ParanoidPostsec{% \label{gmu@postsec} this version of @@ -1754,7 +1983,7 @@ pagella, fontspec=quiet]{gmdocc} \let\ifgmu@postsec\iftrue \def\gmu@getaddvs#1\addvspace#2\gmu@getaddvs{% - \toks\z@={#1} + \toks\z@={#1}% \toks\tw@={#2}} % And the modification of the inner macros at last: @@ -1769,7 +1998,7 @@ pagella, fontspec=quiet]{gmdocc} \def\SetTwoheadSkip#1#2{\@namedef{#1@twoheadskip}{#2}} -}% of |\@ifnotmw|. +}% of |\@ifnotmw|'s else. % \subdivision{My heading setup for \pk{mwcls}} @@ -1786,7 +2015,7 @@ pagella, fontspec=quiet]{gmdocc} \SetSectionFormatting[breakbefore,wholewidth] {part}{\z@\@plus1fill}{}{\z@\@plus3fill}% % - \@ifundefined{chapter}{}{% + \gm@ifundefined{chapter}{}{% \SetSectionFormatting[breakbefore,wholewidth] {chapter} {66\p@}% |{67\p@}|% for Adventor/Schola 0,95. @@ -1830,7 +2059,7 @@ pagella, fontspec=quiet]{gmdocc} }% of |\@ifnotmw| -% \division{Compatibilising standard and \pk{mwcls} sectionings} +% \subdivision{Compatibilising standard and \pk{mwcls} sectionings} % % If you use Marcin Woli\nacute ski's document classes (\pk{mwcls}), you % might have met their little queerness: the sectioning commands take @@ -1913,7 +2142,7 @@ pagella, fontspec=quiet]{gmdocc} % 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 + \gm@ifundefined{#1}{}{% we don't change the ontological status of the % command because someone may test it. \n@melet{\gm@secini#1}{#1}% \@namedef{#1}{% @@ -2067,7 +2296,7 @@ pagella, fontspec=quiet]{gmdocc} % 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} +\gm@ifundefined{AmSTeX} {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex% \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{} @@ -2096,16 +2325,16 @@ pagella, fontspec=quiet]{gmdocc} \DeclareLogo\pdfTeX{pdf\TeX} -\@ifundefined{XeTeX}{% +\gm@ifundefined{XeTeX}{% \DeclareLogo\XeTeX{X\kern-.125em\relax - \@ifundefined{reflectbox}{% + \gm@ifundefined{reflectbox}{% \lower.5ex\hbox{E}\kern-.1667em\relax}{% \lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\relax}% \TeX}}{} -\@ifundefined{XeLaTeX}{% +\gm@ifundefined{XeLaTeX}{% \DeclareLogo\XeLaTeX{X\kern-.125em\relax - \@ifundefined{reflectbox}{% + \gm@ifundefined{reflectbox}{% \lower.5ex\hbox{E}\kern-.1667em\relax}{% \lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\relax}% \LaTeX}} @@ -2142,19 +2371,18 @@ pagella, fontspec=quiet]{gmdocc} \def\@nx\gm@gobmacro##1\@xa\@gobble\string\macro:##2->{}} \gmu@tempa -% 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@reserveda{#1}% - \@xa\long\@xa\def\csname\gmu@reserveda\endcsname{#2}} - - -\long\def\unex@nameuse#1{% - \edef@other\gmu@reserveda{#1}% - \csname\gmu@reserveda\endcsname} - +%^^A % In the next two macros' names, `unex' stands both for not expanding +%^^A % the argument(s) and for disastrously partial unexpandability of the +%^^A % macros themselves. +%^^A +%^^A \long\def\unex@namedef#1#2{% +%^^A \edef@other\gmu@reserveda{#1}% +%^^A \@xa\long\@xa\def\csname\gmu@reserveda\endcsname{#2}} +%^^A +%^^A +%^^A \long\def\unex@nameuse#1{% +%^^A \edef@other\gmu@reserveda{#1}% +%^^A \csname\gmu@reserveda\endcsname} % \division{Brave New World of \XeTeX} @@ -2180,8 +2408,7 @@ pagella, fontspec=quiet]{gmdocc} \RestoreMacro\LaTeX\RestoreMacro*{LaTeX }}% my version of the % \LaTeX\ logo has been stored just % after defining, in line \ref{SMLaTeX}. \ilrr - % ^^A \def\dekfracc##1/##2{\vfrac{##1}{##2}} -}{}} + }{}} % \indent The |\udigits| declaration causes the digits to be typeset % uppercase. I~provide it since by default I~prefer the lowercase @@ -2235,19 +2462,33 @@ pagella, fontspec=quiet]{gmdocc} \gmu@xefraccdef{3/8}{"215C}% \gmu@xefraccdef{5/8}{"215D}% \gmu@xefraccdef{7/8}{"215E}% - \def\dekfracc##1/##2{% + \pdef\dekfracc@args##1/##2{% \def\gm@duppa{##1/##2}% - \@ifundefined{gmu@xefracc\all@other\gm@duppa}{% + \gm@ifundefined{gmu@xefracc\all@other\gm@duppa}{% \gmu@dekfracc{##1}/{##2}}{% - \csname gmu@xefracc\all@other\gm@duppa\endcsname}}% + \csname gmu@xefracc\all@other\gm@duppa\endcsname}% + \if@gmu@mmhbox\egroup\fi + }% of |\dekfracc@args|. \@ifstar{\let\gmu@dekfracc\gmu@dekfraccsimple}{}% } \def\gmu@xedekfraccplain{% `else' of the main |\@ifstar| - \def\dekfracc##1/##2{{% + \pdef\dekfracc@args##1/##2{% + \ifmmode\hbox\fi{% \addfontfeature{Fractions=On}% - ##1/##2}}% - } + ##1/##2}% + \if@gmu@mmhbox\egroup\fi + }% of |\dekfracc@args| + } + +\newif\if@gmu@mmhbox% we'll use this switch for |\dekfracc| and also +% for |\thous| (hacky thousand separator). + +\pdef\dekfracc{% \changes{v0.94}{2008/09/14}{made to work also in math + % mode, even with math-active digits} + \ifmmode\hbox\bgroup\@gmu@mmhboxtrue\fi + \dekfracc@args} + \def\gmu@numeratorkern{\kern-.05em\relax} \let\gmu@denominatorkern\gmu@numeratorkern @@ -2271,41 +2512,12 @@ pagella, fontspec=quiet]{gmdocc} % A~simpler version of |\dekfracc| is provided in line \ref{2292}. % \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\resizegraphics#1#2#3{% % \changes{v0.94}{2008/10/4}{\cs{includegraphics} + % works well in \XeTeX\ so I~remove the complicated version + % with \cs{XeTeXpicfile}} + \resizebox{#1}{#2}{% + \includegraphics{#3}}} \def\GMtextsuperscript{% \@ifXeTeX{% @@ -2323,6 +2535,211 @@ pagella, fontspec=quiet]{gmdocc} %^^A \def\xetikz{\def\pgfsysdriver{pgfsys-dvipdfm.def}% %^^A \usepackage{tikz}} +% \subdivision{Settings for mathematics in main font} I~used these +% terrible macros while typesetting E.~Szarzyński's \textit{Letters} +% in 2008. The \TextUsage\gmath\ declaration introduces math-active +% digits and binary operators and redefines greek letters and parentheses, the +% \TextUsage\garamath\ declaration redefines the quantifiers and is +% more Garamond Premier Pro-specific. + +\pdef\gmath{% \HideDef + \everymath{% \changes{v0.94}{2008/10/4}{removed definition of + % \cs{}\s and \cs{}\s} + \relaxen\do + \newcommand*\do[4][\mathit]{\def##2{##3{##1{\char"##4}}}}% + \do\alpha{}{03B1}% + \do[\mathrm]\Delta{}{0394}% + \do\varepsilon{}{03B5}% + \do\vartheta{}{03D1}% + \do\nu{}{03BD}% + \do\pi{}{03C0}% + \do\phi{}{03D5}% + \do[\mathrm]\Phi{}{0424}% + \do\sigma{}{03C3}% + \do\varsigma{}{03DA}% + \do\psi{}{03C8}% + \do\omega{}{03C9}% + \do\infty{}{221E}% + \do[\mathrm]\neg{\mathbin}{00AC}% + \do[\mathrm]\neq{\mathrel}{2260}% + \do\partial{}{2202}% + \do[\mathrm]\pm{}{00B1}% + \do[\mathrm]\pm{\mathbin}{00B1}% + \do[\mathrm]\sim{\mathrel}{007E}% + % + \def\do##1##2##3{\def##1{% + \mathop{\mathchoice{\hbox{% + \rm + \edef\gma@tempa{\the\fontdimen8\font}% + \larger[3]% + \lower\dimexpr(\fontdimen8\font-\gma@tempa)/2 % + \hbox{##2}}}{\hbox{% + \rm + \edef\gma@tempa{\the\fontdimen8\font}% + \larger[2]% + \lower\dimexpr(\fontdimen8\font-\gma@tempa)/2 % + \hbox{##2}}}% + {\mathrm{##2}}{\mathrm{##2}}}##3}}% + \do\sum{\char"2211}{}% + \do\forall{\gma@quantifierhook \rotatebox[origin=c]{180}{A}% + \setbox0=\hbox{A}\setbox2=\hbox{\scriptsize x}% + \kern\dimexpr\ht2/3*2 -\wd0/2\relax}{\nolimits}% + \do\exists{\rotatebox[origin=c]{180}{\gma@quantifierhook E}}\nolimits% + % + \def\do##1##2##3{\def##1{##3{% + \mathchoice{\hbox{\rm##2}}{\hbox{\rm##2}}% + {\hbox{\rm\scriptsize##2}}{\hbox{\rm\tiny##2}}}}}% + \do\vee{\rotatebox[origin=c]{90}{<}}\mathbin + \do\wedge{\rotatebox[origin=c]{-90}{<}}\mathbin + \do\leftarrow{\char"2190}\mathrel + \do\rightarrow{\char"2192}\mathrel + \do\leftrightarrow{\char"2190\kern-0,1em \char"2192}\mathrel + % + \gmu@storespecials[\do\`\do\"\do\=]% \label{@storespecials} + \gmu@septify[\do\`12\do\"12\do\=12]% + \def\do##1##2##3{% + \catcode`##1=12\relax % to ensure |##2| be `other' in the + % definition body. + \scantokens{\mathcode`##1="8000\relax + \foone{\catcode`##1=\active}{\def##1}{##3{% + \mathchoice{\hbox{\rm##2}}{\hbox{\rm##2}}% + {\hbox{\rm\scriptsize##2}}{\hbox{\rm\tiny##2}}}}% + \ignorespaces}}% to eat the lineend (scantokens acts as |\read| + % icluding line end). + \do..\mathpunct \do,,\mathpunct \do……\mathpunct + \do((\mathopen%^^A)) + \gm@ifundefined{resetMathstrut@}{}{% an error occured `bad mathchar + % etc.'\ because \pk{amsmath.sty} doesn't take account of + % a~possibility of `|(|' %^^A) + % being math-active. + \def\resetMathstrut@{% + \setbox\z@\hbox{% \label{gmu:leading space} \nostanza \gmdnoindent + % |%% \mathchardef\@tempa\mathcode`\(\relax|\\ + % |%% \def\@tempb##1"##2##3{\the\textfont"##3\char"}%|\\ + % |%% \expandafter\@tempb\meaning\@tempa \relax|\nostanza + (%^^A) + }% + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ + }}%^^A(( + \do))\mathclose + \do[[\mathopen\do]]\mathclose + \do-{\char"2212}\mathbin \do++\mathbin \do==\mathrel \do××\mathbin + \do::\mathbin \do··\mathbin \do//\mathbin \do<<\mathrel + \do>>\mathrel + \do00\mathord \do11\mathord \do22\mathord \do33\mathord + \do44\mathord \do55\mathord \do66\mathord \do77\mathord + \do88\mathord \do99\mathord + \gmu@restorespecials + % + \def\do##1##2##3{\def##1####1{##2{\hbox{% + \rm + \setbox0=\hbox{####1}% + \edef\gma@tempa{\the\ht0}% + \edef\gma@tempb{\the\dp0}% + ##3% + \setbox0=\hbox{####1}% + \lower\dimexpr(\ht0 + \dp0)/2-\dp0 -((\gma@tempa+\gma@tempb)/2-\gma@tempb) % + \box0}}}}% + \do\bigl\mathopen\larger + \do\bigr\mathclose\larger + \do\Bigl\mathopen\largerr + \do\Bigr\mathclose\largerr + \do\biggl\mathopen{\larger[3]}% + \do\biggr\mathclose{\larger[3]}% + \do\Biggl\mathopen{\larger[4]}% + \do\Biggr\mathclose{\larger[4]}% + % + \def\do##1##2{\def##1{\ifmmode##2{\mathchoice + {\hbox{\rm\char`##1}}{\hbox{\rm\char`##1}}% + {\hbox{\rm\scriptsize\char`##1}}{\hbox{\rm\tiny\char`##1}}}% + \else\char`##1\fi}}% + %^^A \StoreMacros{\{\}}% + \do\{\mathopen + \do\}\mathclose + % + \def\={\mathbin{=}}% + \def\neqb{\mathbin{\neq}}% + \def\do##1{\edef\gma@tempa{% + \def\@xa\@nx\csname \@xa\gobble\string##1r\endcsname{% + \@nx\mathrel{\@nx##1}}}% + \gma@tempa}% + \do\vee \do\wedge \do\neg + \def\fakern{\mkern-3mu}% + \thickmuskip=8mu plus 4mu\relax + % + \gma@gmathhook + }% of |\everymath|. + \everydisplay\everymath + \ifdefined\Url + \ampulexdef\Url{\let\do}\@makeother + {\everymath{}\let\do\@makeother}% I~don't know why but the + % \pk{url} package's \incs{url} typesets the argument inside + % a~math which caused digits not to be typewriter but Roman and + % lowercase. + \fi + }% of |\def\gmath|. \ResumeDef + +\emptify\gma@quantifierhook +\def\quantifierhook#1{% + \def\gma@quantifierhook{#1}} + +\emptify\gma@gmathhook +\def\gmathhook#1{\addtomacro\gma@gmathhook{#1}} + + +\def\gma@dollar$#1${{\gmath$#1$}}% +\def\gma@bare#1{\gma@dollar$#1$}% +\def\gma@checkbracket{\@ifnextchar\[%^^A\] + \gma@bracket\gma@bare} +\def\gma@bracket\[#1\]{{\gmath\[#1\]}\@ifnextchar\par{}{\noindent}} +\def\gma{\@ifnextchar$%^^A $ + \gma@dollar\gma@checkbracket} + + %^^A In Beamer presentations it will we defined another way. + %^^B trial composition +\def\bgcolor{\color{white}} + +\def\garamath{% + \addtotoks\everymath{% + \quantifierhook{\addfontfeature{OpticalSize=800}}% + % + \def\gma@arrowdash{{% + \setbox0=\hbox{\char"2192}\copy0\kern-0,6\wd0 + \bgcolor\rule[-\dp0]{0,6\wd0}{\dimexpr\ht0+\dp0}\kern-0,6\wd0}}% + % + \def\gma@gmathhook{% + \def\do####1####2####3{\def####1{####3{% + \mathchoice{\hbox{\rm####2}}{\hbox{\rm####2}}% + {\hbox{\rm\scriptsize####2}}{\hbox{\rm\tiny####2}}}}}% + \do\mapsto{\rule[0,4ex]{0,1ex}{0,4ex}\kern-0,05em% + \gma@arrowdash\kern-0,05em\char"2192}\mathrel + \do\cup{\scshape u}\mathbin + \do\varnothing{\setbox0=\hbox{\gma@quantifierhook\addfontfeature{Scale=1.272727}0}% + \setbox2=\hbox{\char"2044}% + \copy0 \kern-0,5\wd0 \kern-0,5\wd2 \lower0,125\wd0 \copy2 + \kern0,5\wd0\kern-0,5\wd2}{}% + \do\leftarrow{\char"2190\kern-0,05em\gma@arrowdash}\mathrel + \do\rightarrow{\gma@arrowdash\kern-0,05em\char"2192}\mathrel + \do\in{\gma@quantifierhook\char"0454}\mathbin + }}% + \everydisplay\everymath} + + + +% \subdivision{Minion and Garamond Premier kerning and ligature fixes} + +%»Ws« shall not make long »s« because long »s« looks ugly next to »W«. + +\def\gmu@tempa{\kern-0,08em\penalty10000\hskip0sp\relax + s\penalty10000\hskip0sp\relax} + +\protected\edef\Vs{V\gmu@tempa} + +\protected\edef\Ws{W\gmu@tempa} + +\pdef\Wz{W\kern-0,05em\penalty10000\hskip0sp\relax z} + + %\division{Varia} % @@ -2623,18 +3040,21 @@ pagella, fontspec=quiet]{gmdocc} % \changes{v0.81}{2007/05/13}{moved here from \pk{pmlectionis.cls}} \def\gmu@dekfraccsimple#1/#2{\leavevmode\kern.1em - \raise.5ex\hbox{\udigits\smaller[3]#1}\gmu@numeratorkern + \raise.5ex\hbox{%^^A \udigits + \smaller[3]#1}\gmu@numeratorkern \dekfraccslash\gmu@denominatorkern %^^A\lower.25ex\hbox - {\udigits\smaller[3]#2}}% + {%^^A\udigits + \smaller[3]#2}% + \if@gmu@mmhbox\egroup\fi} \def\dekfraccsimple{% \label{2292} - \let\dekfracc\gmu@dekfraccsimple + \let\dekfracc@args\gmu@dekfraccsimple } \@ifXeTeX{\def\dekfraccslash{\char"2044 }}{% \def\dekfraccslash{/}} % You can define it as the fraction slash, -% %%%%% \nlpercent|\char"2044 | +% %%%%% \nlpercent|\char"2044 |\ilrr \dekfraccsimple % \changes{v0.81}{2007/05/13}{moved here from \pk{pmlectionis.cls}} @@ -2670,8 +3090,8 @@ pagella, fontspec=quiet]{gmdocc} % 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@getext#1.#2\@@nil{%\UnDef + \def\gmu@filename{#1}%\UnDef \def\gmu@fileext{#2}} \def\include#1{\relax @@ -2681,6 +3101,7 @@ pagella, fontspec=quiet]{gmdocc} \def\@include#1 {% \gmu@getext#1.\@@nil + % \UnDef \ifx\gmu@fileext\empty\def\gmu@fileext{tex}\fi \clearpage \if@filesw @@ -2751,11 +3172,10 @@ pagella, fontspec=quiet]{gmdocc} % \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[1]{{% - \gmu@scapss#1\@@nil}} +% adding redefinition of |\\| caused stack overflow. Note it +% disallows hyphenation except at |\-|. + +\pdef\fakescaps#1{{\gmu@scapss#1\@@nil}} \let\fakescapscore\gmu@scalematchX @@ -2766,7 +3186,7 @@ pagella, fontspec=quiet]{gmdocc} % wg |\zf@calc@scale| pakietu \pk{fontspec}. -\@ifXeTeX{% +\@ifpackageloaded{fontspec}{% \def\gmu@scalar{1.0}% \def\zf@scale{}% \def\gmu@scalematchX{% @@ -2779,7 +3199,7 @@ pagella, fontspec=quiet]{gmdocc} \divide\@tempdimb by1000\relax \divide\@tempdima by\@tempdimb \setlength{\@tempdima}{\@tempdima*\real{\gmu@scalar}}% - \@ifundefined{fakesc@extrascale}{}{% + \gm@ifundefined{fakesc@extrascale}{}{% \setlength{\@tempdima}{\@tempdima*\real{\fakesc@extrascale}}}% \@tempcnta=\@tempdima \divide\@tempcnta by 1000\relax @@ -2802,7 +3222,7 @@ pagella, fontspec=quiet]{gmdocc} % 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}}{% + \edef\gmu@tempa{\gm@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 @@ -2817,7 +3237,7 @@ pagella, fontspec=quiet]{gmdocc} % ``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 +\def\napapierkistretch{0,3pt}% It's quite much for 11/13pt leading. \def\napapierkicore{\advance\baselineskip% by 0ptplus\napapierkistretch\relax} @@ -2848,8 +3268,9 @@ pagella, fontspec=quiet]{gmdocc} \multiply\tolerance by 2\relax \everypar{\looseness=#1\relax}}{\par} -\newcommand*\nawj{\kern0,1em\relax}% to put between parentheses and -% letters with lower … such as $j$ or $y$ in certain fonts. +\newcommand*\nawj{\kern0,1em\relax}% a~kern to be put between +% parentheses and letters with descendants such as $j$ or $y$ in +% certain fonts. % % 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 @@ -2911,8 +3332,10 @@ pagella, fontspec=quiet]{gmdocc} \else \afterfi{% \@ifnextspace{\ppauza@skipcore}{% - \@ifnextMac\ppauza@skipcore{\unskip\discretionary{–}{–}{–}}}}% - \fi}% + \@ifnextMac\ppauza@skipcore{\unskip\discretionary{–}{–}{–}}}% + }% + \fi + }% % \pdef\ppauza{% \ifvmode \PackageError{gmutils}{% @@ -2969,208 +3392,23 @@ pagella, fontspec=quiet]{gmdocc} \@tempcnta=\numexpr\time-(\time-30)/60*60\relax \ifnum\@tempcnta<10 0\fi\the\@tempcnta} -%^^A % To push the stuff up to the header and have the after heading skip -%^^A % after the stuff -%^^A -%^^A \long\def\przeniesvskip#1{% -%^^A \edef\gmu@LastSkip{\the\lastskip}% -%^^A \vskip-\gmu@LastSkip\relax -%^^A \vspace*{0sp}% -%^^A #1\vskip\gmu@LastSkip\relax} -\@ifXeTeX{\chardef\textbullet="2022 }{\def\textbullet{$\bullet$}} +\@ifXeTeX{% + \pdef\textbullet{% \changes{v0.94}{2008/10/3}{the \XeTeX\ + % version enriched with \cs{iffontchar} due to lack of bullets + % with the default settings reported by Morten H\o{}gholm and Edd Barrett} + \iffontchar\font"2022 \char"2022 \else\ensuremath{\bullet}\fi}} +{\def\textbullet{\ensuremath{\bullet}}} \newenvironment*{tytulowa}{\newpage}{\par\thispagestyle{empty}\newpage} % To typeset peoples' names on page 4 (the editorial page): \def\nazwired{\quad\textsc} -% \division{Settings for mathematics in main font} -% I~used these terrible macros while typesetting E.~Szarzyński's -% \textit{Letters} in 2008. The \TextUsage\gmath\ declaration defines -% one-letter an one-digt \CSes etc., the \TextUsage\garamath\ -% declaration redefines the quantifiers and is more Garamond Premier -% Pro-specific. -\pdef\gmath{% - \everymath{% - \def\do##1{\edef##1{{\@nx\mathit{\@xa\@gobble\string##1}}}}% - \do\A \do\a \do\B \do\b \do\c \do\C\do\d \do\D \do\e \do\E\do\f - \do\F\do\g\do\G \do\i\do\I \do\j\do\J \do\k\do\K \do\l \do\L \do\m - \do\M \do\n \do\N \do\P \do\p \do\q \do\Q \do\R \do\r - \let\sectionsign\S \do\S \do\s \do\T \do\t \do\u \do\U \do\v\do\V - \do\w \do\W \do\x \do\X \do\Y \do\y \do\z\do\Z - % - \def\do##1{\edef##1{{\@nx\mathrm{\@xa\@gobble\string##1}}}}% - \do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9% - % - %^^A\typeout{@@@@ przeszło 2897}% - \relaxen\do - \newcommand*\do[4][\mathit]{\def##2{##3{##1{\char"##4}}}}% - \do\alpha{}{03B1}% - \do[\mathrm]\Delta{}{0394}% - \do\varepsilon{}{03B5}% - \do\vartheta{}{03D1}% - \do\nu{}{03BD}% - \do\pi{}{03C0}% - \do\phi{}{03D5}% - \do[\mathrm]\Phi{}{0424}% - \do\sigma{}{03C3}% - \do\varsigma{}{03DA}% - \do\psi{}{03C8}% - \do\omega{}{03C9}% - \do\infty{}{221E}% - \do[\mathrm]\neg{\mathbin}{00AC}% - \do[\mathrm]\neq{\mathrel}{2260}% - \do\partial{}{2202}% - \do[\mathrm]\pm{}{00B1}% - \do[\mathrm]\pm{\mathbin}{00B1}% - \do[\mathrm]\sim{\mathrel}{007E}% - % - \def\do##1##2##3{\def##1{% - \mathop{\mathchoice{\hbox{% - \rm - \edef\gma@tempa{\the\fontdimen8\font}% - \larger[3]% - \lower\dimexpr(\fontdimen8\font-\gma@tempa)/2 % - \hbox{##2}}}{\hbox{% - \rm - \edef\gma@tempa{\the\fontdimen8\font}% - \larger[2]% - \lower\dimexpr(\fontdimen8\font-\gma@tempa)/2 % - \hbox{##2}}}% - {\mathrm{##2}}{\mathrm{##2}}}##3}}% - \do\sum{\char"2211}{}% - \do\forall{\gma@quantifierhook \rotatebox[origin=c]{180}{A}% - \setbox0=\hbox{A}\setbox2=\hbox{\scriptsize x}% - \kern\dimexpr\ht2/3*2 -\wd0/2\relax}{\nolimits}% - \do\exists{\rotatebox[origin=c]{180}{\gma@quantifierhook E}}\nolimits% - % - \def\do##1##2##3{\def##1{##3{% - \mathchoice{\hbox{\rm##2}}{\hbox{\rm##2}}% - {\hbox{\rm\scriptsize##2}}{\hbox{\rm\tiny##2}}}}}% - \do\vee{\rotatebox[origin=c]{90}{<}}\mathbin - \do\wedge{\rotatebox[origin=c]{-90}{<}}\mathbin - \do\leftarrow{\char"2190}\mathrel - \do\rightarrow{\char"2192}\mathrel - \do\leftrightarrow{\char"2190\kern-0,1em \char"2192}\mathrel - % - \gmu@storespecials[\do\`\do\"\do\=]% \label{@storespecials} - \gmu@septify[\do\`12\do\"12\do\=12]% - \def\do##1##2##3{% - \catcode`##1=12\relax - \scantokens{\mathcode`##1="8000\relax - \foone{\catcode`##1=\active}{\def##1}{##3{% - \mathchoice{\hbox{\rm##2}}{\hbox{\rm##2}}% - {\hbox{\rm\scriptsize##2}}{\hbox{\rm\tiny##2}}}}% - \ignorespaces}}% to eat the lineend (scantokens acts as |\read| - % icluding line end). - \do..\mathpunct \do,,\mathpunct \do……\mathpunct - \do((\mathopen%^^A)) - \@ifundefined{resetMathstrut@}{}{% an error occured `bad mathchar - % etc.'\ because \pk{amsmath.sty} doesn't take account of - % a~possibility of `|(|' %^^A) - % being math-active. - \def\resetMathstrut@{% - \setbox\z@\hbox{% \label{gmu:leading space} \nostanza \gmdnoindent - % |%% \mathchardef\@tempa\mathcode`\(\relax|\\ - % |%% \def\@tempb##1"##2##3{\the\textfont"##3\char"}%|\\ - % |%% \expandafter\@tempb\meaning\@tempa \relax|\nostanza - (%^^A) - }% - \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ - }}%^^A(( - \do))\mathclose - \do[[\mathopen\do]]\mathclose - \do-{\char"2212}\mathbin \do++\mathbin \do==\mathrel \do××\mathbin - \do::\mathbin \do··\mathbin \do//\mathbin \do<<\mathrel - \do>>\mathrel - \gmu@restorespecials - % - \def\do##1##2##3{\def##1####1{##2{\hbox{% - \rm - \setbox0=\hbox{####1}% - \edef\gma@tempa{\the\ht0}% - \edef\gma@tempb{\the\dp0}% - ##3% - \setbox0=\hbox{####1}% - \lower\dimexpr(\ht0 + \dp0)/2-\dp0 -((\gma@tempa+\gma@tempb)/2-\gma@tempb) % - \box0}}}}% - \do\bigl\mathopen\larger - \do\bigr\mathclose\larger - \do\Bigl\mathopen\largerr - \do\Bigr\mathclose\largerr - \do\biggl\mathopen{\larger[3]}% - \do\biggr\mathclose{\larger[3]}% - \do\Biggl\mathopen{\larger[4]}% - \do\Biggr\mathclose{\larger[4]}% - % - \def\do##1##2{\def##1{\ifmmode##2{\mathchoice - {\hbox{\rm\char`##1}}{\hbox{\rm\char`##1}}% - {\hbox{\rm\scriptsize\char`##1}}{\hbox{\rm\tiny\char`##1}}}% - \else\char`##1\fi}}% - %^^A \StoreMacros{\{\}}% - \do\{\mathopen - \do\}\mathclose - % - \def\={\mathbin{=}}% - \def\neqb{\mathbin{\neq}}% - \def\do##1{\edef\gma@tempa{% - \def\@xa\@nx\csname \@xa\gobble\string##1r\endcsname{% - \@nx\mathrel{\@nx##1}}}% - \gma@tempa}% - \do\vee \do\wedge \do\neg - \def\fakern{\mkern-3mu}% - \thickmuskip=8mu plus 4mu\relax - % - \gma@gmathhook - }% of |\everymath|. - }% of |\def\gmath|. - -\emptify\gma@quantifierhook -\def\quantifierhook#1{% - \def\gma@quantifierhook{#1}} -\emptify\gma@gmathhook -\def\gmathhook#1{\addtomacro\gma@gmathhook{#1}} -\def\gma@dollar$#1${{\gmath$#1$}}% -\def\gma@bare#1{\gma@dollar$#1$}% -\def\gma@checkbracket{\@ifnextchar\[%^^A\] - \gma@bracket\gma@bare} -\def\gma@bracket\[#1\]{{\gmath\[#1\]}\@ifnextchar\par{}{\noindent}} -\def\gma{\@ifnextchar$%^^A $ - \gma@dollar\gma@checkbracket} - - %^^A In Beamer presentations it will we defined another way. - %^^B trial composition -\def\bgcolor{\color{white}} - -\def\garamath{% - \quantifierhook{\addfontfeature{OpticalSize=800}}% - % - \def\gma@arrowdash{{% - \setbox0=\hbox{\char"2192}\copy0\kern-0,6\wd0 - \bgcolor\rule[-\dp0]{0,6\wd0}{\dimexpr\ht0+\dp0}\kern-0,6\wd0}}% - % - \def\gma@gmathhook{% - \def\do####1####2####3{\def####1{####3{% - \mathchoice{\hbox{\rm####2}}{\hbox{\rm####2}}% - {\hbox{\rm\scriptsize####2}}{\hbox{\rm\tiny####2}}}}}% - \do\mapsto{\rule[0,4ex]{0,1ex}{0,4ex}\kern-0,05em% - \gma@arrowdash\kern-0,05em\char"2192}\mathrel - \do\cup{\scshape u}\mathbin - \do\varnothing{\setbox0=\hbox{\gma@quantifierhook\addfontfeature{Scale=1.272727}0}% - \setbox2=\hbox{\char"2044}% - \copy0 \kern-0,5\wd0 \kern-0,5\wd2 \lower0,125\wd0 \copy2 - \kern0,5\wd0\kern-0,5\wd2}{}% - \do\leftarrow{\char"2190\kern-0,05em\gma@arrowdash}\mathrel - \do\rightarrow{\gma@arrowdash\kern-0,05em\char"2192}\mathrel - \do\in{\gma@quantifierhook\char"0454}\mathbin - }} - - -% \division{Typesetting dates in my memoirs} +% \subdivision{Typesetting dates in my memoirs} % A~date in the |YYYY-MM-DD| format we'll transform into % `\acro{DD mmmm YYYY}' @@ -3179,49 +3417,52 @@ pagella, fontspec=quiet]{gmdocc} % preserve compatibility with already used macros and to avoid % a~starred version of |\thedate| and the same time to be able to turn % |\datef| off in some cases (for \file{SevSev04.tex}). -% \Define\datef \newcommand*\polskadata{% - \def\datef##1-##2-##3##4{% - \if\relax##2\relax##3##4% + \def\gmu@datef##1-##2-##3##4,##5\gmu@datef{% + \ifx\relax##2\relax##3##4% \else - \ifnum##3##4=0\relax - \else - \ifnum##3=0\relax - \else##3% - \fi##4% - \fi + \ifnum##3\@firstofmany##40\@@nil=0\relax + \else + \ifnum0##3=0\relax + \else##3% + \fi##4% + \fi \ifcase##2\relax\or\ stycznia\or\ lutego% - \or\ marca\or\ kwietnia\or\ maja\or\ czerwca\or\ lipca\or\ sierpnia% - \or\ września\or\ października\or\ listopada\or\ grudnia\else - {}% + \or\ marca\or\ kwietnia\or\ maja\or\ czerwca\or\ lipca\or\ sierpnia% + \or\ września\or\ października\or\ listopada\or\ grudnia\else + {}% \fi \if\relax##1\relax\else\ \fi ##1% - \fi}% -% -% \Define\datefsl -\def\datefsl##1/##2/##3##4{% - \if\relax##2\relax##3##4% - \else - \ifnum##3##4=0\relax + \fi + \gmu@datecomma{##5}}% of \incs{gmu@datef}. + % + \def\gmu@datefsl##1/##2/##3##4,##5\gmu@datefsl{% + \if\relax##2\relax##3##4% + \else + \ifnum##3\@firstofmany##40\@@nil=0\relax \else - \ifnum##3=0\relax - \else##3% - \fi##4% + \ifnum0##3=0\relax + \else##3% + \fi##4% \fi \ifcase##2\relax\or\ stycznia\or\ lutego% - \or\ marca\or\ kwietnia\or\ maja\or\ czerwca\or\ lipca\or\ sierpnia% - \or\ września\or\ października\or\ listopada\or\ grudnia\else - {}% + \or\ marca\or\ kwietnia\or\ maja\or\ czerwca\or\ lipca\or\ sierpnia% + \or\ września\or\ października\or\ listopada\or\ grudnia\else + {}% \fi \if\relax##1\relax\else\ \fi ##1% - \fi}% + \fi + \gmu@datecomma{##5}}% }% of |\polskadata| +%^^A \def\datef#1-#2-#3#4{\gmu@datef#1-#2-#3#4\gmu@datef}% +%^^A \def\datefsl#1/#2/#3#4{\gmu@datefsl#1/#2/#3#4\gmu@datefsl} + \polskadata % For documentation in English: \newcommand*\englishdate{% - \def\datef##1-##2-##3##4{% + \def\gmu@datef##1-##2-##3##4,##5\gmu@datef{% \if\relax##2\relax##3##4% \else \ifcase##2\relax\or January\or February% @@ -3229,18 +3470,19 @@ pagella, fontspec=quiet]{gmdocc} \or September\or October\or November\or December\else {}% \fi - \ifnum##3##4=0\relax + \ifnum##3\@firstofmany##40\@@nil=0\relax \else \ % - \ifnum##3=0\relax + \ifnum0##3=0\relax \else##3% \fi##4% - \ifcase##3##4\relax\or st\or nd\or rd\else th\fi + \ifcase##3\@firstofmany##4\relax\@@nil\relax\or st\or nd\or rd\else th\fi \fi - \if\relax##1\relax\else,\ \fi ##1% + \ifx\relax##1\relax\else,\ \fi ##1% \fi - }% - \def\datefsl##1/##2/##3##4{% + \gmu@datecomma{##5}}% +% + \def\gmu@datefsl##1/##2/##3##4,##5\gmu@datefsl{% \if\relax##2\relax##3##4% \else \ifcase##2\relax\or January\or February% @@ -3248,33 +3490,45 @@ pagella, fontspec=quiet]{gmdocc} \or September\or October\or November\or December\else {}% \fi - \ifnum##3##4=0\relax + \ifnum##3\@firstofmany##40\@@nil=0\relax \else \ % - \ifnum##3=0\relax + \ifnum0##3=0\relax \else##3% \fi##4% - \ifcase##3##4\relax\or st\or nd\or rd\else th\fi + \ifcase##3\@firstofmany##4\relax\@@nil\relax\or st\or nd\or rd\else th\fi \fi \if\relax##1\relax\else,\ \fi ##1% \fi - }% + \gmu@datecomma{##5}}% } + +\def\gmu@datecomma#1{% sometimes we want to typeset something like `11 + % września, czwartek' so we add handling for comma in the + % \incs{ldate}'s argument. + \ifx\gmu@datecomma#1\gmu@datecomma\else + ,\gmu@stripcomma#1% + \fi +}% of |\gmu@datecomma| + +\def\gmu@stripcomma#1,{#1} + + \newif\ifgmu@dash \def\gmu@ifnodash#1-#2\@@nil{% - \def\@tempa{#2}% - \ifx\@tempa\@empty} + \def\gmu@tempa{#2}% + \ifx\gmu@tempa\@empty} -\def\gmu@testdash#1\ifgmu@dash{% +\pdef\gmu@testdash#1\ifgmu@dash{% \gmu@ifnodash#1-\@@nil \gmu@dashfalse \else \gmu@dashtrue \fi \ifgmu@dash} -% A~word of explanation to the above pair of macros. |\gmu@testdash| +% A~word of explanation to the pair of macros above. |\gmu@testdash| % sets |\iftrue| the |\ifgmu@dash| switch if the argument contains an % explicit |-|. To learn it, an auxiliary |\gmu@ifdash| macro is used % that expands to an open (un|\fi|ed) |\ifx| that tests whether the @@ -3306,24 +3560,38 @@ pagella, fontspec=quiet]{gmdocc} % Dates for memoirs to be able to typeset them also as diaries. \newif\ifdate %^^A|%\newcounter{dateinsection}[section]| -\newcommand*{\data}[1]{% - \ifdate\gmu@testdash#1\ifgmu@dash\datef#1\else\datefsl#1\fi\fi} +\pdef\bidate#1{% + \ifdate\gmu@testdash#1% + \ifgmu@dash + \gmu@datef#1,\gmu@datef + \else + \gmu@datefsl#1,\gmu@datefsl + \fi\fi} -\newcommand*{\linedate}[1]{\par\ifdate\addvspace{\dateskip}% - \date@line{\footnotesize\itshape \date@biway{#1}}% +\pdef\linedate{\@ifstar\linedate@@\linedate@} +\pdef\linedate@@#1{\linedate@{--{}{}#1}} +\pdef\linedate@#1{\par\ifdate\addvspace{\dateskip}% + \date@line{\footnotesize\itshape \bidate{#1}}% \nopagebreak\else%|%\ifnum\arabic{dateinsection}>0\dekbigskip\fi| \addvspace{\bigskipamount}% \fi}% end of |\linedate|. \let\dateskip\medskipamount -\def\date@biway#1{% - \gmu@testdash#1\ifgmu@dash\datef#1\else\datefsl#1\fi} - -\newcommand*\rdate[1]{\let\date@line\rightline \linedate{#1}} -\newcommand*\ldate[1]{\let\date@line\leftline \linedate{#1}} +%^^A \pdef\date@biway#1{% +%^^A \gmu@testdash#1% +%^^A \ifgmu@dash\gmu@datef#1\gmu@datef +%^^A \else\gmu@datefsl#1\gmu@datefsl +%^^A \fi} + +\pdef\rdate{\let\date@line\rightline \linedate} +\pdef\ldate{%\changes{v0.94}{2008/09/06}{\cs{leftline} + % replaced with \cs{par}…\cs{par} to work well with \pk{floatflt}} + \def\date@line##1{\par{\raggedright##1\par}}% + \linedate} \newcommand*\runindate[1]{% - \paragraph{\footnotesize\itshape \datef#1\@@nil}\stepcounter{dateinsection}} + \paragraph{\footnotesize\itshape \gmu@datef#1\gmu@datef}% + \stepcounter{dateinsection}} % I'm not quite positive which side I~want the date to be put to so % let's |let| for now and we'll be able to change it in the very documents. \let\thedate\ldate @@ -3420,18 +3688,6 @@ pagella, fontspec=quiet]{gmdocc} -% \subdivision{Minion and Garamond Premier kerning and ligature fixes} - -%»Ws« shall not make long »s« because long »s« looks ugly next to »W«. - -\def\gmu@tempa{\kern-0,08em\penalty10000\hskip0sp\relax - s\penalty10000\hskip0sp\relax} - -\protected\edef\Vs{V\gmu@tempa} - -\protected\edef\Ws{W\gmu@tempa} - -\pdef\Wz{W\kern-0,05em\penalty10000\hskip0sp\relax z} % \subdivision{A~left-slanted font} Or rather a~left Italic \emph{and} % left slanted font. In both cases we sample the skewness of the @@ -3561,6 +3817,24 @@ pagella, fontspec=quiet]{gmdocc} % Now write |\xathousep{\numexpr 10*9*8*7*6*120}| to get % \xathousep{\numexpr 90*8*7*6*120}. +\def\shortthousep{% + \pdef\thous{% + \ifmmode\hbox\bgroup\@gmu@mmhboxtrue\fi + \afterassignment\thous@inner + \@tempcnta=}%^^A} + % + \def\thous@inner{% + \ifnum\@tempcnta<0 $-$% + \@tempcnta=-\@tempcnta + \fi + \xathousep\@tempcnta + \if@gmu@mmhbox\egroup + \else\afterfi{\@ifnextcat a\space{}}% + \fi}% +}% of |\shortthousep|. +% +% And now write \shortthousep |\thous 3628800| to get \thous 3628800 even with +% a~blank space (beware of the range of \TeX's counts). % \subdivision{Storing and restoring the catcodes of specials} @@ -3636,11 +3910,23 @@ pagella, fontspec=quiet]{gmdocc} % \changes{v0.93}{2008/08/29}{The numerical macros commented out as % obsolete and never really used} % +% \changes{v0.94}{2008/09/08}{\cs{bgroup} and \cs{egroup} in the +% macro storing commands and in \cs{foone} changed to \cs{begingroup} +% and \cs{endgroup} since the former produce an empty \cs{mathord} in +% math mode while the latter don't} +% +% \changes{v0.94}{2008/10/4}{The code from ancient \pk{xparse} (1999) of \TeX +% Live 2007 rewritten here} +% +% \changes{v0.94}{2008/10/4}{removed \cs{unex@namedef} and +% \cs{unex@nameuse}, probably never really used since they were +% incomplete: \cs{edef@other} undefined} +% % \PrintChanges\PrintIndex %\NoEOF % (For my GNU Emacs:) %%% Local Variables: %%% mode: doctex -%%% TeX-master: "../../../../LaTeX/TeXGuru/gmutils/gmutilsDoc.tex" +%%% coding: utf-8 %%% End: -- cgit v1.2.3