% The UCW Macro Collection (a successor of mjmac.tex)
-% Written by Martin Mares <mj@ucw.cz> in 2010 and placed into public domain
-% -------------------------------------------------------------------------
+% Written by Martin Mares <mj@ucw.cz> in 2010--2013 and placed into public domain
+% -------------------------------------------------------------------------------
%%% Prolog %%%
\ifx\pdfoutput\undefined
\else\ifnum\pdfoutput>0
\pdftrue
+ \pdfpkresolution=600 % Provide a reasonable default
\fi\fi
%%% Page size and margins %%%
\voffset=\topmargin
\advance\voffset by -1truein
\ifpdf
+ \pdfhorigin=1truein
+ \pdfvorigin=1truein
\pdfpagewidth=\pagewidth
\pdfpageheight=\pageheight
\fi
\def\setmargins#1{\sethmargins{#1}\setvmargins{#1}}
% Define inner/outer margin instead of left/right
-\def\setinneroutermargin#1#2{\sethmargins{#1}{#2}\evenpageshift=\rightmargin\advance\evenpageshift by -\leftmargin}
+\def\setinneroutermargin#1#2{\leftmargin#1\relax\rightmargin#2\relax\evenpageshift=\rightmargin\advance\evenpageshift by -\leftmargin}
% Use a predefined paper format, calls \setuppage automagically
\def\setpaper#1{%
\defpaper{a3}{297truemm}{420truemm}
\defpaper{a4}{210truemm}{297truemm}
\defpaper{a5}{148truemm}{210truemm}
-\defpaper{a6}{105truemm}{148truemm}
\defpaper{letter}{8.5truein}{11truein}
\defpaper{legal}{8.5truein}{14truein}
% Set all dimensions of a given box register to zero
\def\smashbox#1{\ht#1=0pt \dp#1=0pt \wd#1=0pt}
-\def\smashedhbox#1{{\setbox0=\hbox{#1}\smashbox0\box0}}
-\def\smashedvbox#1{{\setbox0=\vbox{#1}\smashbox0\box0}}
+\long\def\smashedhbox#1{{\setbox0=\hbox{#1}\smashbox0\box0}}
+\long\def\smashedvbox#1{{\setbox0=\vbox{#1}\smashbox0\box0}}
% Variants of \llap and \rlap working equally on both sides and/or vertically
\def\hlap#1{\hbox to 0pt{\hss #1\hss}}
\long\def\placeat#1#2#3{\smashedhbox{\hskip #1\lower #2\hbox{#3}}}
% Like \vbox, but with reference point in the upper left corner
-\def\vhang#1{\vtop{\hrule height 0pt\relax #1}}
+\long\def\vhang#1{\vtop{\hrule height 0pt\relax #1}}
% Like \vhang, but respecting interline skips
-\def\vhanglines#1{\vtop{\hbox to 0pt{}#1}}
+\long\def\vhanglines#1{\vtop{\hbox to 0pt{}#1}}
% Crosshair with reference point in its center
\def\crosshair#1{\clap{\vrule height 0.2pt width #1}\clap{\vrule height #1 width 0.2pt}}
% and underlays, which are zero-size vboxes positioned absolutely in the
% front / in the back of the normal material. Also, there are global
% versions of both which are not reset after every page.
-\def\addlay#1#2{\setbox#1=\vbox{\ifvbox#1\box#1\fi\smashedvbox{#2}}}
+\def\addlay#1#2{\setbox#1=\vbox{\ifvbox#1\box#1\fi\nointerlineskip\smashedvbox{#2}}}
\def\pageunderlay{\addlay\pageunderlays}
\def\pageoverlay{\addlay\pageoverlays}
\def\commonunderlay{\addlay\commonoverlays}
% Our variation on \plainoutput, which manages inner/outer margins and overlays
\output{\ucwoutput}
+\newdimen\pagebodydepth
\def\ucwoutput{\wigglepage\shipout\vbox{%
\makeheadline
\ifvbox\commonunderlays\copy\commonunderlays\nointerlineskip\fi
\ifvbox\pageunderlays\box\pageunderlays\nointerlineskip\fi
\pagebody
- \ifvbox\commonoverlays\vbox to 0pt{\vskip -\vsize\copy\commonoverlays}\fi
- \ifvbox\pageoverlays\vbox to 0pt{\vskip -\vsize\box\pageoverlays}\fi
+ \pagebodydepth=\prevdepth
+ \nointerlineskip
+ \ifvbox\commonoverlays\vbox to 0pt{\vskip -\vsize\copy\commonoverlays\vss}\nointerlineskip\fi
+ \ifvbox\pageoverlays\vbox to 0pt{\vskip -\vsize\box\pageoverlays\vss}\nointerlineskip\fi
+ \prevdepth=\pagebodydepth
\makefootline
}\advancepageno
\ifnum\outputpenalty>-\@MM \else\dosupereject\fi}
\def\wigglepage{\ifodd\pageno\else\advance\hoffset by \evenpageshift\fi}
+% Make it easier to redefine footline font (also, fix it so that OFS won't change it unless asked)
+\let\footfont=\tenrm
+\footline={\hss\footfont\folio\hss}
+
%%% Itemization %%%
% Default dimensions of itemized lists
\zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
\or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
-\def\itm{\:}
+%%% Miscellanea %%%
+
+% {\I italic} with automatic italic correction
+\def\I{\it\aftergroup\/}
+
+% A breakable dash, to be repeated on the next line
+\def\={\discretionary{-}{-}{-}}
+
+% Non-breakable identifiers
+\def\<#1>{\leavevmode\hbox{\I #1}}
+
+% A handy shortcut
+\let\>=\noindent
+
+% Variants of \centerline, \leftline and \rightline, which are compatible with
+% verbatim environments and other catcode hacks
+\def\cline{\bgroup\def\linet@mp{\aftergroup\box\aftergroup0\aftergroup\egroup\hss\bgroup\aftergroup\hss\aftergroup\egroup}\afterassignment\linet@mp\setbox0\hbox to \hsize}
+\def\lline{\bgroup\def\linet@mp{\aftergroup\box\aftergroup0\aftergroup\egroup\bgroup\aftergroup\hss\aftergroup\egroup}\afterassignment\linet@mp\setbox0\hbox to \hsize}
+\def\rline{\bgroup\def\linet@mp{\aftergroup\box\aftergroup0\aftergroup\egroup\hss\bgroup\aftergroup\egroup}\afterassignment\linet@mp\setbox0\hbox to \hsize}
%%% Epilog %%%