X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucwmac.tex;h=0d2c9061071c31b735af8156c9489ec30bf791de;hb=c7310a545ce08560c0c2cd314603e4d695c2b10c;hp=881c6dbce2943508f74b724d0f03b6458df21c3b;hpb=47d56f50af35f5d75c64e6242e3b571cd193babf;p=ucwmac.git diff --git a/ucwmac.tex b/ucwmac.tex index 881c6db..0d2c906 100644 --- a/ucwmac.tex +++ b/ucwmac.tex @@ -1,146 +1,6 @@ -% The UCW Macro Collection (a successor of mjmac.tex) -% Written by Martin Mares in 2010 and placed into public domain -% ------------------------------------------------------------------------- +% Emulate behavior of historic ucwmac -%%% Prolog %%% +\input ucwmac2.tex -% We'll use internal macros of plain TeX -\catcode`@=11 - -%%% PDF output detection %%% - -\newif\ifpdf -\pdffalse - -\ifx\pdfoutput\undefined -\else\ifnum\pdfoutput>0 - \pdftrue -\fi\fi - -%%% Page size and margins %%% - -% If you modify these registers, call \setuppage afterwards -\newdimen\pagewidth -\newdimen\pageheight -\newdimen\leftmargin -\newdimen\rightmargin -\newdimen\topmargin -\newdimen\bottommargin -\newdimen\evenpageshift - -\def\setuppage{% - \hsize=\pagewidth - \advance\hsize by -\leftmargin - \advance\hsize by -\rightmargin - \vsize=\pageheight - \advance\vsize by -\topmargin - \advance\vsize by -\bottommargin - \hoffset=\leftmargin - \advance\hoffset by -1truein - \voffset=\topmargin - \advance\voffset by -1truein - \ifpdf - \pdfpagewidth=\pagewidth - \pdfpageheight=\pageheight - \fi -} - -% Set multiple margins to the same value -\def\sethmargins#1{\leftmargin=#1\relax\rightmargin=#1\relax\evenpageshift=0pt\relax} -\def\setvmargins#1{\topmargin=#1\relax\bottommargin=#1\relax} -\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} - -% Use a predefined paper format, calls \setuppage automagically -\def\setpaper#1{% - \expandafter\let\expandafter\currentpaper\csname paper-#1\endcsname - \ifx\currentpaper\relax - \errmessage{Undefined paper format #1} - \fi - \currentpaper -} - -% Switch to landscape orientation, calls \setuppage automagically -\def\landscape{% - \dimen0=\pageheight - \pageheight=\pagewidth - \pagewidth=\dimen0 - \setuppage -} - -% Common paper sizes -\def\defpaper#1#2#3{\expandafter\def\csname paper-#1\endcsname{\pagewidth=#2\pageheight=#3\setuppage}} -\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} - -% Default page parameters -\setmargins{1truein} -\setpaper{a4} - -%%% Placing material at specified coordinates %%% - -% 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}} - -% Variants of \llap and \rlap working equally on both sides and/or vertically -\def\hlap#1{\hbox to 0pt{\hss #1\hss}} -\def\vlap#1{\vbox to 0pt{\vss #1\vss}} -\def\clap#1{\vlap{\hlap{#1}}} - -% \placeat{right}{down}{hmaterial} places , so that its -% reference point lies at the given position wrt. the current ref point -\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}} - -% Like \vhang, but respecting interline skips -\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}} - -%%% Output routine %%% - -\newbox\pageunderlays -\newbox\pageoverlays -\newbox\commonunderlays -\newbox\commonoverlays - -% In addition to the normal page contents, you can define page overlays -% 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\pageunderlay{\addlay\pageunderlays} -\def\pageoverlay{\addlay\pageoverlays} -\def\commonunderlay{\addlay\commonoverlays} -\def\commonoverlay{\addlay\commonoverlays} - -% Our variation on \plainoutput, which manages inner/outer margins and overlays -\output{\ucwoutput} -\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 - \makefootline -}\advancepageno -\ifnum\outputpenalty>-\@MM \else\dosupereject\fi} - -\def\wigglepage{\ifodd\pageno\else\advance\hoffset by \evenpageshift\fi} - -%%% Epilog %%% - -% Let's hide all internal macros -\catcode`@=12 +\preitemizepenalty=0 +\postitemizepenalty=0