diff options
author | Karl Berry <karl@freefriends.org> | 2008-08-08 00:16:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-08-08 00:16:39 +0000 |
commit | a2444258e7c328aa0982582d9ca7399f9537cdb7 (patch) | |
tree | b2838c1a20caec3cfb09801004b9802acaf55b57 /Master/texmf-dist/tex/latex/gmutils | |
parent | 7b37fc86daf49c2c785df46295e7ef08caa2862a (diff) |
gmutils update (7aug08)
git-svn-id: svn://tug.org/texlive/trunk@10159 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmutils')
-rw-r--r-- | Master/texmf-dist/tex/latex/gmutils/gmutils.sty | 1164 |
1 files changed, 930 insertions, 234 deletions
diff --git a/Master/texmf-dist/tex/latex/gmutils/gmutils.sty b/Master/texmf-dist/tex/latex/gmutils/gmutils.sty index 8793dbcf664..63efb272a15 100644 --- a/Master/texmf-dist/tex/latex/gmutils/gmutils.sty +++ b/Master/texmf-dist/tex/latex/gmutils/gmutils.sty @@ -9,7 +9,7 @@ %%Written by Grzegorz Murzynowski, %% natror at o2 dot pl %% -%% \copyright\,2005, 2006, 2007 by Grzegorz Murzynowski. +%% \copyright\,2005, 2006, 2007, 2008 by Grzegorz Murzynowski. %% %% This program is subject to the \LaTeX\ Project Public License. %% See ^^A @@ -44,11 +44,38 @@ % \chschange{v0.80}{2007/4/29}{1689} % \chschange{v0.84}{2007/11/13}{2684} % \chschange{v0.85}{2007/11/16}{2795} -% +% \chschange{v0.87}{2008/8/3}{4027} +% \chschange{v0.88}{2008/8/3}{4040} +% \chschange{v0.90}{2008/8/4}{4035} +% \chschange{v0.91}{2008/8/6}{4055} +% + +% \iffalse we skip the driver +\ifnum\catcode`\@=12 + +\documentclass[codespacesgrey,outeroff,pagella]{gmdocc} +\usepackage{eufrak}% for |\continuum| in the commentary. +\twocoltoc +\begin{document} + +\DocInput{\jobname.sty}%e:/texmf/tex/latex/gm/ +\PrintChanges +\thispagestyle{empty} +\typeout{% + Produce change log with^^J% + makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J + (gmglo.ist should be put into some texmf/makeindex directory.)^^J} +\typeout{% + Produce index with^^J% + makeindex -r \jobname^^J} +\afterfi{\end{document}} + +\fi% of driver pass +%\fi \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmutils} - [2007/11/16 v0.85 some rather TeXnical macros, some of them tricky (GM)] + [2008/08/06 v0.91 some rather TeXnical macros, some of them tricky (GM)] % % \tableofcontents @@ -95,7 +122,10 @@ % % The last of the above files (the \pk{.pdf}, i.e., \emph{this % file}) is a~documentation compiled from the \pk{.sty} file by -% running \LaTeX\ on the \pk{gmutilsDoc.tex} file twice, +% running \LaTeX\ on the \pk{gmutilsDoc.tex} file twice +% (|xelatex gmutils.sty| in the directory you wish the +% documentation to be in, you don't have copy the \file{.sty} file +% there, \TeX\ will find it), % then MakeIndex on the \file{gmutils.idx} file, and then \LaTeX\ % on \file{gmutilsDoc.tex} once more. % @@ -118,6 +148,21 @@ % \pk{mwcls}, the standard \pk{article.cls} class would be used. % \end{gmlonely} % +\ifx\XeTeXversion\relax +\let\XeTeXversion\@undefined% If someone earlier used the + % |\@ifundefined{XeTeXversion}| to test +% whether the engine is \XeTeX, then |\XeTeXversion| \emph{is} defined +% in the sense of \eTeX\ tests. In that case we |\let| it to something +% really undefined. Well, we might keep sticking to |\@ifundefined|, +% but it's a~macro and it eats its arguments, freezing their catcodes, +% which is not what we want in line \ref{not@ifundef} +\fi + +\ifdefined\XeTeXversion +\XeTeXinputencoding utf-8 % we use Unicode dashes later in this file. +\fi% and if we are not in \XeTeX, we skip them thanks to \XeTeX-test. + + % % \division{A~couple of abbreviations} % \Define\@xa \Define\@nx @@ -216,8 +261,8 @@ \newcommand*\g@emptify{\global\@emptify} \@ifdefinable\gemptify{\let\gemptify\g@emptify} -% \Define\@relaxen \Define\relaxen -\newcommand*\@relaxen[1]{\let#1=\relax} +% \Define\relaxen +\newcommand\@relaxen[1]{\let#1=\relax} \@ifdefinable\relaxen{\let\relaxen\@relaxen} % Note the two following commands are in fact one-argument. @@ -364,9 +409,9 @@ % \Define\@ifnextspace \def\@ifnextspace#1#2{% - \let\@reserveda\*% + \let\gmu@reserveda\*% \def\*{% - \let\*\@reserveda + \let\*\gmu@reserveda \ifx\@let@token\gm@letspace\afterfi{#1}% \else\afterfi{#2}% \fi}% @@ -558,8 +603,6 @@ % And a~handful of shorthands: % -% \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}} @@ -596,6 +639,12 @@ \let\gobbletwo\@gobbletwo +% \division{Some `other' stuff} +% Here I~define a~couple of macros expanding to special chars made +% `other'. It's important the \acro{CS} are expandable and therefore +% they can occur e.g. inside |\csname...\endcsname| unlike e.g. +% \acro{CS}'es |\chardef|ed. +% % \Define\subs \foone{\catcode`\_=8 }% {\let\subs=_} @@ -603,9 +652,21 @@ \foone{\@makeother\_}% {\def\xiiunder{_}} -\@ifundefined{XeTeXversion}{}{% +\ifdefined\XeTeXversion \def\xiiunder{\char"005F }% - \let\_\xiiunder} + \let\_\xiiunder +\fi + +\foone{\catcode`\[=1 \@makeother\{ + \catcode`\]=2 \@makeother\}}% +[% + \def\xiilbrace[{]% + \def\xiirbrace[}]% +]% of |\firstofone| + +% Note that \LaTeX's |\@charlb| and |\@charrb| are of catcode 11 +% (`letter'), cf. The \LaTeXe\ Source file k, lines 129--130. + % Now, let's define such a~smart |_| (underscore) which will be usual @@ -628,7 +689,7 @@ %^^A] balancing braces for Emacs % \CodeEscapeChar\\ -\@ifundefined{bslash}{\let\bslash=\xiibackslash}{} +\let\bslash=\xiibackslash % \begin{oldmc} @@ -642,6 +703,21 @@ \foone{\@makeother\ }% {\def\xiispace{ }} +% We introduce \cs{visiblespace} from Will Robertson's \pk{xltxtra} if +% available. It's not sufficient |\@ifpackageloaded{xltxtra}| since +% \cs{xxt@visiblespace} is defined only unless |no-verb| option is +% set. 2008/08/06 I~recognized the difference between \cs{xiispace} +% which has to be plain `other' char (used in \cs{xiistring}) and +% something visible to be printed in any font. + +\AtBeginDocument{% + \ifdefined\xxt@visiblespace + \let\visiblespace\xxt@visiblespace + \else + \let\visiblespace\xiispace + \fi} + + %\division{Metasymbols} % I~fancy also another Knuthian trick for typesetting \<metasymbols> % in \TeXbook. So I~repeat it here. The inner |\meta| macro is @@ -656,10 +732,10 @@ % which has no patterns associated with it and use this to typeset the words within % the angle brackets. % \end{quotation} -% \Define\meta \DefIndex\l@nohyphenation -\ifx\l@nohyphenation\undefined - \newlanguage\l@nohyphenation -\fi +%^^A~\DefIndex\l@nohyphenation +%^^A~\ifx\l@nohyphenation\undefined +%^^A~ \newlanguage\l@nohyphenation +%^^A~\fi \DeclareRobustCommand*\meta[1]{% % \begin{quotation} % Since the old implementation of |\meta| could be used in math we better ensure @@ -674,13 +750,13 @@ \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. -% \DefIndex\meta@hyphen@restore - \edef\meta@hyphen@restore{% - \hyphenchar\the\font\the\hyphenchar\font}% - \hyphenchar\font\m@ne - \language\l@nohyphenation +%^^A~% \DefIndex\meta@hyphen@restore +%^^A \edef\meta@hyphen@restore{% +%^^A \hyphenchar\the\font\the\hyphenchar\font}% +%^^A \hyphenchar\font\m@ne +%^^A \language\l@nohyphenation #1\/% - \meta@hyphen@restore +%^^A~ \meta@hyphen@restore }\ensuremath\rangle } @@ -715,19 +791,13 @@ \def\:{\ifmmode\afterfi{\mskip\medmuskip}\else\afterfi{\discret{}}\fi} % \Define\vs -\newcommand*{\vs}{\discre{\textvisiblespace}{}{\textvisiblespace}} +\newcommand*{\vs}{\discre{\visiblespace}{}{\visiblespace}} % 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). % % \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 / -% ^^A but recently I~don't like this delimiter. -% ^^A A~test: \printspaces{Ala ma kota }\par -% ^^A \printspaces{Ala ma aligatora} \def\printspaces#1{{\let~=\vs \let\ =\vs \gm@pswords#1 \@@nil}} % \DefIndex\gm@pswords \def\gm@pswords#1 #2\@@nil{% @@ -739,11 +809,27 @@ % \Define\sfname \Define\file \DeclareRobustCommand*\sfname[1]{\textsf{\printspaces{#1}}} -\let\file\sfname% it allows the spaces in the filenames (and prints + +\def\gmu@discretionaryslash{\discre{/}{\hbox{}}{/}}% the second + % pseudo-argument nonempty to get + % |\hyphenpenalty| not |\exhyphenpenalty|. + + +\DeclareRobustCommand*\file[1]{\gmu@printslashes#1/\gmu@printslashes} + +\def\gmu@printslashes#1/#2\gmu@printslashes{% + \sfname{#1}% + \ifx\gmu@printslashes#2\gmu@printslashes + \else + \textsf{\gmu@discretionaryslash}% + \afterfi{\gmu@printslashes#2\gmu@printslashes}\fi} + + +% it allows the spaces in the filenames (and prints % them as \vs). % The below macro I~use to format the packages' names. -% \Define\pk \Define\file +% \Define\pk \DeclareRobustCommand*{\pk}[1]{\textsf{\textup{#1}}} % Some (if not all) of the below macros are copied from \pk{doc} @@ -832,6 +918,9 @@ %\changes{v0.67}{06/10/11}{enriched with \cs{makeatletter}} \def\StoreMacro{% \bgroup\makeatletter\@ifstar\egStore@MacroSt\egStore@Macro} +% The unstarred version takes a~\acro{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}} @@ -902,6 +991,7 @@ \fi \fi} + % And for the restoring %\Define\RestoreMacro %\changes{v0.61}{06/09/05}{added.} @@ -944,6 +1034,21 @@ \def\StoredMacro{\bgroup\makeatletter\Stored@Macro} \long\def\Stored@Macro#1{\egroup\Restore@Macro#1#1} +% To be able to call a~stored \acro{CS} without restoring it. +\def\storedcsname#1{%% \changes{v0.88}{2008/08/03}{added} + \csname /gmu/store\bslash#1\endcsname} + + +% 2008/08/03 we need to store also an environment. +\def\StoreEnvironment#1{% \label{StoreEnvironment} +% \changes{v0.88}{2008/08/03}{added} + \StoreMacro*{#1}\StoreMacro*{end#1}} + +\def\RestoreEnvironment#1{% +% \changes{v0.88}{2008/08/03}{added} + \RestoreMacro*{#1}\RestoreMacro*{end#1}} + + % It happended (see the definition of |\@docinclude| in \pk{gmdoc.sty}) % that I~needed to |\relax| a~bunch of macros and restore them after % some time. Because the macros were rather numerous and I~wanted the @@ -1022,8 +1127,6 @@ \def\do##1{\ifx#1##1\else\@nx\do\@nx##1\fi}% \xdef\@preamblecmds{\@preamblecmds}}} - - \not@onlypreamble\@preamblecmds \not@onlypreamble\@ifpackageloaded \not@onlypreamble\@ifclassloaded @@ -1039,10 +1142,20 @@ \def\do#1{\@nx\do\@nx#1}% \edef\@preamblecmds{% \def\@nx\do##1{% - \def##1{! \@nx\string##1 \@nx\gm@notprerr}}% + \def##1{\@nx\PackageError{gmutils/LaTeX}% + {\@nx\string##1 \@nx\gm@notprerr}\@nx\@eha}}% \@preamblecmds}} +% A~subtle error raises: the \LaTeX\ standard |\@onlypreamble| and +% what |\document| does with |\@preamblecmds| makes any two of `only +% preamble' \acro{CS}'s |\ifx|-identical inside \env{document}. And my +% change makes any two \acro{CS}'s |\ifx|-different. The first it +% causes a~problem is |\nocite| that checks +% |\ifx\@onlypreamble\document|. So hoping this is a~rare problem, we +% circumvent in with +\def\nocite#1{% + \@bsphack{\setbox0=\hbox{\cite{#1}}}\@esphack} @@ -1274,6 +1387,16 @@ % 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. +% +%\begin{enumargs}^^B +%\item (optional) the flags, e.g. |breakbefore|, |breakafter|; +%\item the sectioning name, e.g. |chapter|, |part|; +%\item preskip; +%\item heading type; +%\item postskip +%\end{enumargs} +% + \relaxen\SetSectionFormatting \newcommand*\SetSectionFormatting[5][\empty]{% \ifx\empty#1\relax\else% empty (not |\empty|!) |#1| also launches |\else|. @@ -1334,119 +1457,96 @@ % 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}} +\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 +% |\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). + }} - \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@}} +\let\ifgmu@postsec\iftrue - \gmu@setheading\mw@normalheading - \gmu@setheading\mw@runinheading +\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}} +\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}} % @@ -1770,7 +1870,6 @@ \DeclareLogo\pdfTeX{pdf\TeX} -%^^A\@ifXeTeX{}{} \@ifundefined{XeTeX}{% \DeclareLogo\XeTeX{X\kern-.125em\relax \@ifundefined{reflectbox}{% @@ -1803,15 +1902,12 @@ % Don't use them in |\edef|s, they would expand not quite. % \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. -% - -% \Define\def@other - -\long\def\def@other#1#2{% - \long\def\gm@def@other@tempa{#2}% - \all@other#1{#2}} +%^^A~% The next macro turns its |#2| all into `other' chars and assigns +%^^A~% them to |#1| which has to be a~\acro{CS} or an active char. +%^^A~% \Define\def@other +%^^A~\long\def\def@other#1#2{% +%^^A~ \long\def\gm@def@other@tempa{#2}% +%^^A~ \all@other#1{#2}} % 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 @@ -1820,8 +1916,7 @@ \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. -% +% beginnig, |long macro:->| all `other' that is. Use of it: % \Define\gm@gobmacro \edef\gmu@reserveda{% \def\@nx\gm@gobmacro##1\@xa\@gobble\string\macro:->{}} @@ -1844,20 +1939,28 @@ % \division{Brave New World of \XeTeX} \newcommand\@ifXeTeX[2]{% - \@xa\ifx\csname XeTeXversion\endcsname\relax - \afterfi{#2}\else\afterfi{#1}\fi} + \ifdefined\XeTeXversion + \unless\ifx\XeTeXversion\relax\afterfifi{#1}\else\afterfifi{#2}\fi + \else\afterfi{#2}\fi} -%^^A \Define\withXeTeX -%^^A~\let\withXeTeX\@ifXeTeX -\def\XeTeXthree{% +\def\XeTeXthree{% \changes{v0.90}{2008/8/4}{adjusted to the redefinition of + % \cs{verb} in \pk{xlxtra} 2008/07/29} \@ifXeTeX{% -%^^A \SMglobal\StoreMacro\LaTeX -%^^A \SMglobal\StoreMacro*{LaTeX }% we want \emph{our} version -%^^A of |\LaTeX|. - \RequirePackage{fontspec}% - \RequirePackage{xunicode}% - \RequirePackage{xltxtra}% + % ^^A \SMglobal\StoreMacro\LaTeX + % ^^A \SMglobal\StoreMacro*{LaTeX }% we want \emph{our} version + % ^^A of |\LaTeX|. + % ^^A \RequirePackage{fontspec}% these two packages are loaded + % ^^A \RequirePackage{xunicode}% by \pk{xltxtra} + \@ifpackageloaded{gmverb}{\StoreMacro\verb}{}% + \RequirePackage{xltxtra}% since v 0.4 (2008/07/29) this package + % redefines |\verb| and \env{verbatim*}, + % and quite elegantly provides an option + % to suppress the redefinitions, but + % unfortunately that option excludes also + % a~nice definition of |\xxt@visiblespace| + % which I~fancy. + \@ifpackageloaded{gmverb}{\RestoreMacro\verb}{}% \AtBeginDocument{% \RestoreMacro\LaTeX\RestoreMacro*{LaTeX }}% my version of the % \LaTeX\ logo has been stored just @@ -1879,38 +1982,62 @@ % \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{{% +\def\Xedekfracc{\@ifstar\gmu@xedekfraccstar\gmu@xedekfraccplain} + % (plain) The starless version turns the font feature |frac| on. + % + % (*) But nor Minion GM neither \TeX\ Gyre Pagella 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|). + % + % (**) But Latin Modern Sans Serif Quotation doesn't support the + % numerator and denominator positions so we provide the double + % star version for it, which takes the char from font if it exist + % and typesets with lowers and kerns otherwise. + +\def\gmu@xedekfraccstar{% + \def\gmu@xefraccdef##1##2{% + \iffontchar\font ##2 + \@namedef{gmu@xefracc##1}{\char##2 }% + \else + \n@melet{gmu@xefracc##1}{relax}% + \fi}% + % + \def\gmu@dekfracc##1/##2{% + {\addfontfeature{VerticalPosition=Numerator}##1}\gmu@numeratorkern + \char"2044 \gmu@denominatorkern + {\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. + \gmu@xefraccdef{1/4}{"BC}% + \gmu@xefraccdef{1/2}{"BD}% + \gmu@xefraccdef{3/4}{"BE}% + \gmu@xefraccdef{1/3}{"2153}% + \gmu@xefraccdef{2/3}{"2154}% + \gmu@xefraccdef{1/8}{"215B}% + \gmu@xefraccdef{3/8}{"215C}% + \gmu@xefraccdef{5/8}{"215D}% + \gmu@xefraccdef{7/8}{"215E}% + \def\dekfracc##1/##2{% + \def\gm@duppa{##1/##2}% + \@ifundefined{gmu@xefracc\all@other\gm@duppa}{% + \gmu@dekfracc{##1}/{##2}}{% + \csname gmu@xefracc\all@other\gm@duppa\endcsname}}% + \@ifstar{\let\gmu@dekfracc\gmu@dekfraccsimple}{}% + } + +\def\gmu@xedekfraccplain{% `else' of the main |\@ifstar| + \def\dekfracc##1/##2{{% \addfontfeature{Fractions=On}% - ####1/####2}}% - \let\fnfracc\dekfracc - }} + ##1/##2}}% + } + +\def\gmu@numeratorkern{\kern-.05em\relax} +\let\gmu@denominatorkern\gmu@numeratorkern + + % 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 @@ -1926,6 +2053,7 @@ % 4. (The \LaTeXe\ Source claims that that is changed in the `new % implementation' of |\@ifstar| so maybe it's subject to change.) +% A~simpler version of |\dekfracc| is provided in line \ref{2292} % \subdivision{\cs{resizegraphics}} % @@ -1972,10 +2100,15 @@ \def\truetextsuperscript{% \DeclareRobustCommand*\textsuperscript[1]{% - \@textsuperscript{\selectfont##1}} + \@textsuperscript{\selectfont##1}}% \def\@textsuperscript##1{% {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@##1}}}}}} +%^^A %\subdivision{Proper loading of \pk{tikz}} +%^^A \def\xetikz{\def\pgfsysdriver{pgfsys-dvipdfm.def}% +%^^A \usepackage{tikz}} + + %\division{Varia} % @@ -1994,9 +2127,11 @@ \AtBeginDocument{% to bypass redefinition of |\~| as a~text command % with various encodings - \DeclareRobustCommand*\~{% + \DeclareRobustCommand*\texttilde{% + %%%%%% \changes{v0.86}{2007/12/11}{renamed from \bslash\texttilde\ + %%%%%% since the latter is one of~\LaTeX\ accents} \@ifnextchar/{\gmu@tilde\kern-0,1667em\relax}\gmu@tilde}} -% We prepare the proper kerning for ``\~/''. +% We prepare the proper kerning for ``\texttilde/''. % The standard |\obeyspaces| declaration just changes the space's % |\catcode| to \catactive\ (`active'). Usually it is fairly enough @@ -2057,7 +2192,7 @@ % % % A~trick for making |\protected@write| immediate. What's a~use of it? % % See the next macro. -% % CodeDefine\MakeWriteImmediate +% % Define\MakeWriteImmediate % % CodeDefIndex\@@write % % changes{v0.65}{06/9/26}{added} % \newcommand*\MakeWriteImmediate{% @@ -2067,7 +2202,7 @@ % % First I~used it for closing of \env{multicols} in the \file{.toc} % % file. Second time to make \emph{two} tables of contents containing % % two different parts of the document -% % CodeDefine\ImmediateAddtoConts +% % Define\ImmediateAddtoConts % % changes{v0.65}{06/9/26}{added} % \newcommand\ImmediateAddtoConts[2]{{% % \MakeWriteImmediate @@ -2112,15 +2247,6 @@ % And for the \LaTeX's pseudo-code statements: \newcommand*\eequals{${}=={}$} -% The job name without extension. -% \Define\jobnamewoe -\def\gm@jobn#1.#2\@@nil{#1} - -\def\jobnamewoe{\@xa\gm@jobn\jobname.\@@nil}% We add the dot -% to be sure there is one although I'm not sure whether you can \TeX\ -% a~file that has no extrension. - - % While typesetting a~UTF-8 ls-R result I~found a~difficulty that % follows: UTF-8 encoding is handled by the \pk{inputenc} @@ -2205,30 +2331,49 @@ % And this macro I~saw in the \pk{ltugproc} document class nad I~liked % it. -\def\acro#1{\gmu@acroinner#1\gmu@acroinner} +\def\iteracro{% + \DeclareRobustCommand*\acro[1]{\gmu@acrospaces##1 \gmu@acrospaces}% +} + +\iteracro + +\def\gmu@acrospaces#1 #2\gmu@acrospaces{% + \gmu@acroinner#1\gmu@acroinner + \ifx\relax#2\relax\else + \space + \afterfi{\gmu@acrospaces#2\gmu@acrospaces}% when |#2| is nonempty, + % it is ended with a~space. Adding one + % more space in this line resulted in + % an infinite loop. + \fi} + \def\gmu@acroinner#1{% - \ifx\gmu@acroinner#1\else - \ifcat a\@nx#1% + \ifx\gmu@acroinner#1\relax\else + \ifcat a\@nx#1\relax% \ifnum`#1=\uccode`#1% - {\scshape\lowercase{#1}}% - \else{\smallerr#1}% + {\acrocore{#1}}% + \else{#1}% tu było |\smallerr| \fi \else#1% \fi \afterfi\gmu@acroinner \fi} +% We extract the very thing done to the letters to a~macro because we +% need to redefine it in fonts that don't have small caps. +\def\acrocore{\scshape\lowercase} + % 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}} +\DeclareRobustCommand*\usc[1]{{\addfontfeature{Letters=UppercaseSmallCaps}#1}} + +\def\uscacro{\let\acro\usc} + \newcommand*\qxenc{\fontencoding{QX}\selectfont} % The |\copyright| command is unavailable in T1 and U~(unknown) % encodings so provide @@ -2266,14 +2411,21 @@ %^^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\gmu@dekfraccsimple#1/#2{\leavevmode\kern.1em + \raise.5ex\hbox{\udigits\smaller[3]#1}\gmu@numeratorkern + \dekfraccslash\gmu@denominatorkern + %^^A\lower.25ex\hbox + {\udigits\smaller[3]#2}}% -\def\fnfracc#1/#2{\leavevmode\kern.1em - \raise.6ex\hbox{\udigits\tiny#1}\kern-.1em - /\kern-.1em\lower.25ex\hbox{\udigits\tiny#2}} +\def\dekfraccsimple{% \label{2292} + \let\dekfracc\gmu@dekfraccsimple +} +\@ifXeTeX{\def\dekfraccslash{\char"2044 }}{% + \def\dekfraccslash{/}} % You can define it as the fraction slash, +% %%%%% \nlpercent|\char"2044 | +\dekfraccsimple + % \changes{v0.81}{2007/05/13}{moved here from \pk{pmlectionis.cls}} @@ -2284,8 +2436,10 @@ %\changes{v0.82}{2007/07/17}{added} % And a~macro to forbid hyphenation of the next word: -\newcommand*\nohy{\kern\z@} - +\newcommand*\nohy{\kern0sp\relax} +\newcommand*\yeshy{\penalty10000\hskip0sp\relax} +% In both of the above definitionc `0sp' not |\z@| to allow their +% writing to and reading from files where @ is `other'. % \subdivision{\cs{@ifempty}} @@ -2367,7 +2521,7 @@ \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| + {\fakescapscore\MakeUppercase{#1}}% not Plain |\uppercase| % because that works bad with \pk{inputenc}. \else#1% \fi @@ -2389,8 +2543,10 @@ % 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}} +\DeclareRobustCommand\fakescaps[1]{{% + \gmu@scapss#1\@@nil}} + +\let\fakescapscore\gmu@scalematchX % Experimente z~akcentami patrz no3.tex. \def\tinycae{{\tiny\AE}}% to use in |\fakescaps[\tiny]{...}| @@ -2400,6 +2556,8 @@ % wg |\zf@calc@scale| pakietu \pk{fontspec}. \@ifXeTeX{% + \def\gmu@scalar{1.0}% + \def\zf@scale{}% \def\gmu@scalematchX{% \begingroup \ifx\zf@scale\empty\def\gmu@scalar{1.0}% @@ -2450,31 +2608,557 @@ \def\napapierkistretch{0,3pt}% It's quite much for 11/13pt typesetting +\def\napapierkicore{\advance\baselineskip% + by 0ptplus\napapierkistretch\relax} + \newenvironment*{napapierki}{% - \par\global\advance\baselineskip% - by 0ptplus\napapierkistretch\relax}{% + \par\global\napapierkicore}{% \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} +\newcount\gmu@luzniej +\newcommand*\luzniejcore[1][1]{% + \advance\gmu@luzniej\@ne% We use this count to check whether we open + % the environment or just set |\looseness| inside it again. + \ifnum\gmu@luzniej=\@ne \multiply\tolerance by 2 \fi + \looseness=#1\relax} +% After |\begin{luzniej}| we may put the optional argument of +% |\luzniejcore| +\newenvironment*{luzniej}{\par\luzniejcore}{\par} + + +% The starred version does that |\everypar|, which has its advantages +% and disadvantages. +\newenvironment*{luzniej*}[1][1]{% + \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. +% % 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 +\ifdefined\XeTeXversion \AtBeginDocument{% to be independent of moment of loading of \pk{polski}. + \DeclareRobustCommand*\—{% + \ifhmode + \unskip\penalty10000 + \afterfi{% + \@ifnextspace{\hskip0.2em plus0.1em\relax + \pauzacore\hskip.2em plus0.1em\relax\ignorespaces}% + {\pauzacore\penalty\hyphenpenalty\hskip\z@}}% + \else + % According to \tytul{Instrukcja technologiczna. Skład ręczny ^^B + % i~maszynowy} the dialogue dash should be followed by a~rigid + % hskip of \dekfracc1/2\,em. + \leavevmode\pauzacore\penalty10000\hskip0,5em\ignorespaces + \fi}% + % The next command's name consists of letters and therefore it eats + % any spaces following it, so |\@ifnextspace| would always be false. \DeclareRobustCommand*\pauza{% - \ifhmode\unskip\penalty10000\hskip0.2em plus0.1em\relax\fi - \pauzacore\hskip.2em plus0.1em\ignorespaces}} + \ifhmode + \unskip\penalty10000 + \hskip0.2em plus0.1em\relax + \pauzacore\hskip.2em plus0.1em\relax\ignorespaces% + \else + % According to \tytul{Instrukcja technologiczna. Skład ręczny ^^B + % i~maszynowy} the dialogue dash should be followed by a~rigid + % hskip of \dekfracc1/2\,em. + \leavevmode\pauzacore\penalty10000\hskip0,5em\ignorespaces + \fi}% + % And a~version with no space at the left, to begin a~|\noindent| + % paragraph or a~dialogue in quotation marks: + \DeclareRobustCommand*\lpauza{% + \pauzacore\hskip.2em plus0.1em\ignorespaces}% + % + % We define |\ppauza| as an en dash surrounded with thin stretchable + % spaces and sticking to the upper line or bare but discretionary + % depending on the next token being space${}_10$. Of course you'll + % never get such a~space after a~literal CS so an explicit |\ppauza| + % will always result with a~bare discretionary en dash, but if we + % |\let–\ppauza|… + \DeclareRobustCommand*\–{% + \ifvmode \PackageError{gmutils}{% + command \bslash ppauza (en dash) not intended for vmode.}{% + Use \bslash ppauza (en dash) only in number and numeral ranges.}% + \else + \afterfi{% + \@ifnextspace{\unskip\penalty10000\hskip0.2em plus0.1em\relax + –\hskip.2em plus0.1em\ignorespaces}{\unskip\discretionary{–}{–}{–}}}% + \fi}% + % + \DeclareRobustCommand*\ppauza{% + \ifvmode \PackageError{gmutils}{% + command \bslash ppauza (en dash) not intended for vmode.}{% + Use \bslash ppauza (en dash) only in number and numeral ranges.}% + \else + \unskip\discretionary{–}{–}{–}% + \fi}% + % + \def\emdash{\char`\—} +}% of at begin document -\def\pauzacore{---} +\def\longpauza{\def\pauzacore{—}} +\longpauza \def\shortpauza{% - \def\pauzacore{--\kern,23em\relax\llap{--}}} + \def\pauzacore{–\kern,23em\relax\llap{–}}} +\fi% of if \XeTeX. + +% If you have all the three dashes on your keyboard (as I~do), you may want to use +% them for short instead of |\pauza|, |\ppauza| and |\dywiz|. The +% shortest dash is defined to be smart in math mode and result with +% $-$. +\ifdefined\XeTeXversion +\foone{\catcode`—\active \catcode`–\active \catcode`-\active}{%\label{not@ifundef} + \def\adashes{\AtBeginDocument\adashes}% because |\pauza| + % is defined at begin document. + \AtBeginDocument{\def\adashes{% + \catcode`—\active \let—\—% + \catcode`–\active \let–\–% +% ^^A \catcode`-\active \let-\gmu@dywiz +}}} +\else +\relaxen\adashes +\fi + + +% The hyphen shouldn't be active \acro{IMO} because it's used in \TeX\ +% control such as |\hskip-2pt|. Therefore we provide the |\ahyphen| +% declaration reluctanly, because sometimes we need it and always use +% it with caution. Note that my active hyphen in vertical and math +% modes expands to |-|\catother. + +\def\gmu@dywiz{\ifmmode-\else + \ifvmode-\else\afterfifi\dywiz\fi\fi}% + +\foone{\catcode`-\active}{% + \def\ahyphen{\let-\gmu@dywiz\catcode`\-\active}} + + +% To get current time. Works in \eTeX s, icluding \XeTeX. +\newcommand*\czas[1][.]{% + \the\numexpr(\time-30)/60\relax#1% + \@tempcnta=\numexpr\time-(\time-30)/60*60\relax + \ifnum\@tempcnta<10 0\fi\the\@tempcnta} + +% To push the stuff up to the header and have the after heading skip +% after the stuff + +\long\def\przeniesvskip#1{% + \edef\gmu@LastSkip{\the\lastskip}% + \vskip-\gmu@LastSkip\relax + \vspace*{0sp}% + #1\vskip\gmu@LastSkip\relax} + +\@ifXeTeX{\chardef\textbullet="2022 }{\def\textbullet{$\bullet$}} + +\newenvironment*{tytulowa}{\newpage}{\par\thispagestyle{empty}\newpage} + +% Nazwisko na stronę redakcyjną +\def\nazwired{\quad\textsc} + +% \division{Settings for mathematics in main font} +% I~used this terrible macros while typesetting E.~Szarzyński's +% \textit{Letters} in 2008. +\def\gmath{% + \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% + % + \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 + % + \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 + \@ifundefined{resetMathstrut@}{}{% an error occured `bad mathchar + % etc.'\ because \pk{amsmath.sty} doesn't take account of + % a~possibility of |(| %) + % being math-active. + \def\resetMathstrut@{% + \setbox\z@\hbox{% + % |%% \mathchardef\@tempa\mathcode`\(\relax| + % |%% \def\@tempb##1"##2##3{\the\textfont"##3\char"}%| + % |%% \expandafter\@tempb\meaning\@tempa \relax| + (}% + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ + }}% + \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 + % + \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}}% +\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 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} + +% A~date in the |YYYY-MM-DD| format we'll transform into DD mmmm YYYY +% format or we'll just typeset next two tokens/|{...}| if the +% arguments' string begins with |--|. The latter option is provided to +% 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% + \else + \ifnum##3##4=0\relax + \else + \ifnum##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 + {}% + \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 + \else + \ifnum##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 + {}% + \fi + \if\relax##1\relax\else\ \fi ##1% + \fi}% +}% of |\polskadata| + +\polskadata + +% For documentation in English: +\newcommand*\englishdate{% + \def\datef##1-##2-##3##4{% + \if\relax##2\relax##3##4% + \else + \ifcase##2\relax\or January\or February% + \or March\or April\or May\or June\or July\or August% + \or September\or October\or November\or December\else + {}% + \fi + \ifnum##3##4=0\relax + \else + \ % + \ifnum##3=0\relax + \else##3% + \fi##4% + \ifcase##3##4\relax\or st\or nd\or rd\else th\fi + \fi + \if\relax##1\relax\else,\ \fi ##1% + \fi + }% + \def\datefsl##1/##2/##3##4{% + \if\relax##2\relax##3##4% + \else + \ifcase##2\relax\or January\or February% + \or March\or April\or May\or June\or July\or August% + \or September\or October\or November\or December\else + {}% + \fi + \ifnum##3##4=0\relax + \else + \ % + \ifnum##3=0\relax + \else##3% + \fi##4% + \ifcase##3##4\relax\or st\or nd\or rd\else th\fi + \fi + \if\relax##1\relax\else,\ \fi ##1% + \fi + }% +} + +\newif\ifgmu@dash + +\def\gmu@ifnodash#1-#2\@@nil{% + \def\@tempa{#2}% + \ifx\@tempa\@empty} + +\def\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| +% 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 +% dash put by us is the only one in the argument string. This is done +% by matching the parameter string that contains a~dash: if the +% investigated sequence contains (another) dash, |#2| of |\gmu@ifdash| +% becomes the rest of it and the `guardian' dash put by us so then +% it's nonempty. Then |#2| is took as the definiens of |\@tempa| so if +% it was empty, |\@tempa| becomesx equal |\@empty|, otherwise it isx +% not. +% +% Why don't we use just |\gmu@ifdash|? Because we want to put this +% test into another |\if...|. A~macro that doesn't \emph{mean} +% |\if...| wouldn't match its |\else| nor its |\fi| while \TeX\ would +% skip the falsified branch of the external |\if...| and that would +% result in the `extra |\else|' or 'extra |\fi|' error. +% +% Therefore we wrap the very test in a~macro that according to its +% result sets an explicit Boolean switch and write this switch right +% after the testing macro. (Delimiting |\gmu@testdash|'es parameter +% with this switch is intended to bind the two which are not one +% because of \TeX nical reasons only. +% +% Warning: this pair of macros may result in `extra |\else|/extra +% |\fi|' errors however, if |\gmu@testdash| was |\expandafter|ed. + + + +% Dates for memoirs to be able to typeset them also as diaries. +\newif\ifdate +%|%\newcounter{dateinsection}[section]| +\newcommand*{\data}[1]{% + \ifdate\gmu@testdash#1\ifgmu@dash\datef#1\else\datefsl#1\fi\fi} + +\newcommand*{\linedate}[1]{\par\ifdate\addvspace{\dateskip}% + \date@line{\footnotesize\itshape \date@biway{#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}} +\newcommand*\runindate[1]{% + \paragraph{\footnotesize\itshape \datef#1\@@nil}\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 + + +\DeclareRobustCommand*\zwrobcy[1]{\emph{#1}} %ostinato, allegro con moto, + %garden party etc., także kompliment + +\DeclareRobustCommand*\tytul[1]{\emph{#1}} + + +% Maszynopis w~świecie justowanym zrobi delikatną chorągiewkę. +\newenvironment{maszynopis}[1][]{#1\ttfamily + \hyphenchar\font=45\relax% to przypisanie jest globalne do fontu. + \@tempskipa=\glueexpr\rightskip+\leftskip\relax + \ifdim\gluestretch\@tempskipa=\z@ + \tolerance900 + % sprawdziło się przy tolerancji 900 + \advance\rightskip by\z@ plus0,5em\relax\fi + \fontdimen3\font=\z@% zabraniamy rozciągania odstępów, ale + %|% \fontdimen4\font=\z@| dopuszczamy ich skurczenie + \hyphenpenalty0 % żeby nie stresować \TeX a: w~maszynopisie + % ten wspaniały algorytm dzielenia akapitu powinien + % być wyłączony, a~każdy wiersz łamany na ostatnim + % dopuszczalnym miejscu przełamania. + \StoreMacro\pauzacore + \def\pauzacore{-\rlap{\kern-0,3em-}-}% +}{\par} + + + +\newcommand*\justified{% + \leftskip=1\leftskip% to preserve the natural length and discard + % stretch and shrink. + \rightskip=1\rightskip + \parfillskip=1\parfillskip + \advance\parfillskip by 0sp plus 1fil\relax + \let\\\@normalcr} + + +% For dati under poems. + +\newcommand\wherncore[1]{% + \rightline{% + \parbox{0,7666\textwidth}{ + \leftskip0sp plus \textwidth + \parfillskip0sp\relax + \let\\\linebreak + \footnotesize #1}}} + +\newcommand\whern[1]{% + \vskip\whernskip + \wherncore{#1}} + +\newskip\whernskip +\whernskip2\baselineskip minus 2\baselineskip\relax + +\newcommand\whernup[1]{\par\wherncore{#1}} + + + +% \subdivision{Minion and Garamond Premier kerning and ligature fixes} + +% „Ws” nie będzie robiło długiego „s”, bo źle wygląda przy „W” +\DeclareRobustCommand*\Ws{W\kern-0,08em\penalty10000\hskip0sp\relax + s\penalty10000\hskip0sp\relax} + +\DeclareRobustCommand*\Wz{W\kern-0,05em\penalty10000\hskip0sp\relax z} \endinput @@ -2507,6 +3191,18 @@ % \changes{v0.85}{2007/11/16}{fixed behaviour of too clever headings % with \pk{gmdoc} by adding an \cs{ifdim} test} % +% \changes{v0.87}{2008/08/03}{the package goes \eTeX\ even more, +% making use of \cs{ifdefined} and the code using\acro{UTF-8} chars is +% wrapped in a~\XeTeX-condition} +% +% \changes{v0.89}{2008/08/04}{removed obsolete adjustment of \pk{pgf} +% for \XeTeX} +% +% \changes{v0.91}{2008/08/06}{removed \cs{jobnamewoe} since +% \cs{jobname} is always without extension. \cs{xiispace} forked to +% \cs{visiblespace} \cs{let} to \cs{xxt@visiblespace} of \pk{xltxtra} +% if available. The documentation driver integrated with the \file{.sty} file} +% % % \PrintChanges\PrintIndex %\NoEOF |