mirror of
https://github.com/kennethreitz/context.git
synced 2026-06-05 23:00:17 +00:00
408 lines
11 KiB
TeX
408 lines
11 KiB
TeX
%% BEGIN poster.tex/poster.sty
|
|
%%
|
|
\def\fileversion{1.2}
|
|
\def\filedate{93/08/28}
|
|
%%
|
|
%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU
|
|
%%
|
|
%% DESCRIPTION:
|
|
%% poster.tex/poster.sty contains a macro for making posters and banners
|
|
%% with TeX. It is compatible with most TeX macro packages, including Plain
|
|
%% TeX, LaTeX, AmSTeX, and Ams-LaTeX. The only special requirement is that
|
|
%% your printer not be bothered by text that lies off the page. This is
|
|
%% true of most printers, including laser printers and PostScript printers.
|
|
%%
|
|
%% INSTALLATION:
|
|
%% Put this file where your TeX looks for inputs, under the name poster.tex.
|
|
%% Name a copy poster.sty to use as a LaTeX style option, or create a file
|
|
%% poster.sty with the lines:
|
|
%% \input poster.tex
|
|
%% \endinput
|
|
%%
|
|
%% DOCUMENTATION:
|
|
%% See poster.doc, and the sample files poster1.tex and poster2.tex.
|
|
%% These might be appended to this file.
|
|
%%
|
|
%% COPYING:
|
|
%% Copying of part or all of this file is allowed under the following
|
|
%% conditions only:
|
|
%% (1) You may freely distribute unchanged copies of the file. Please
|
|
%% include the documentation when you do so.
|
|
%% (2) You may modify a renamed copy of the file, but only for personal
|
|
%% use or use within an organization.
|
|
%% (3) You may copy fragments from the file, for personal use or for
|
|
%% distribution, as long as credit is given where credit is due.
|
|
%%
|
|
%% You are NOT ALLOWED to take money for the distribution or use of
|
|
%% this file or modified versions or fragments thereof, except for
|
|
%% a nominal charge for copying etc.
|
|
%%
|
|
%% CODE:
|
|
% These macros use TeX primitives, plus the Plain TeX commands:
|
|
% \dimen@, \dimen@i, \count@, \newcount, \newtoks,
|
|
% \p@, \z@, \@ne
|
|
%
|
|
% Check if file is loaded, announce file on terminal, and take care of @:
|
|
%
|
|
\csname PosterLoaded\endcsname
|
|
\let\PosterLoaded\endinput
|
|
|
|
\message{\space\space v\fileversion\space\space\filedate\space\space <tvz>}
|
|
|
|
\edef\TheAtCode{\the\catcode`\@}
|
|
\catcode`\@=11
|
|
|
|
\newbox\@posterbox
|
|
\newbox\poster@savedbox
|
|
\newbox\poster@cropbox
|
|
\newcount\poster@cnt
|
|
|
|
\def\POSTERpaperheight{11in}
|
|
\def\POSTERpaperwidth{8.5in}
|
|
\def\POSTERimageheight{10in}
|
|
\def\POSTERimagewidth{7.5in}
|
|
\def\POSTERlandscape{false}
|
|
\def\POSTERclip{none}
|
|
\def\POSTERcrop{corners}
|
|
\def\POSTERcropwidth{2pt}
|
|
\def\POSTERvcenter{false}
|
|
\def\POSTERhcenter{false}
|
|
\def\POSTERimmediatewrites{true}
|
|
\def\POSTERnumbering{automatic}
|
|
|
|
\def\poster@set#1[#2]{%
|
|
\poster@@set#2,=\@nil,%
|
|
\csname posterwrites@\POSTERimmediatewrites\endcsname
|
|
#1}
|
|
\def\poster@@set#1=#2,{%
|
|
\ifx\@nil#2\else
|
|
\expandafter\ifx\csname POSTER#1\endcsname\relax
|
|
\errmessage{Poster parameter `#1' not defined}%
|
|
\else
|
|
\expandafter\edef\csname POSTER#1\endcsname{#2}%
|
|
\fi
|
|
\expandafter\poster@@set
|
|
\fi}
|
|
|
|
\def\poster@true{true}
|
|
|
|
\def\poster{%
|
|
\begingroup
|
|
\futurelet\next\poster@i}
|
|
\def\poster@i{%
|
|
\ifx\next[%
|
|
\expandafter\poster@set
|
|
\fi
|
|
\poster@ii}
|
|
\def\poster@ii{%
|
|
\let\posternumbering@automatic\posternumbering@rowcol
|
|
\afterassignment\poster@iii
|
|
\setbox\@posterbox=\hbox}
|
|
\def\poster@iii{\aftergroup\poster@iv}
|
|
\def\poster@iv{%
|
|
\setbox\@posterbox=\hbox{\raise\dp\@posterbox\box\@posterbox}%
|
|
\poster@savepage
|
|
\poster@magtonum
|
|
\ifx\POSTERlandscape\poster@true \poster@landscape \fi
|
|
\poster@hoffsets
|
|
\poster@voffsets
|
|
\ifx\POSTERvcenter\poster@true \poster@vcenter \fi
|
|
\ifx\POSTERhcenter\poster@true \poster@hcenter \fi
|
|
\poster@makecropbox
|
|
\count\@ne=\z@
|
|
\poster@vloop
|
|
\endgroup}
|
|
|
|
\def\Poster{%
|
|
\begingroup
|
|
\futurelet\next\Poster@i}
|
|
\def\Poster@i{%
|
|
\ifx\next[%
|
|
\expandafter\poster@set
|
|
\fi
|
|
\Poster@ii}
|
|
\def\Poster@ii{%
|
|
\let\posternumbering@automatic\posternumbering@rowcol
|
|
\setbox\@posterbox=\hbox\bgroup\ignorespaces}
|
|
\def\endPoster{\egroup\poster@iv}
|
|
|
|
\def\PosterPage{\futurelet\next\PosterPage@i}
|
|
\def\PosterPage@i{%
|
|
\ifx\next[%
|
|
\expandafter\poster@set
|
|
\fi
|
|
\PosterPage@ii}
|
|
\def\PosterPage@ii{%
|
|
\let\posternumbering@automatic\posternumbering@page
|
|
\let\poster@trueshipout\shipout
|
|
\let\shipout\poster@pageshipout}
|
|
\def\poster@pageshipout{%
|
|
\begingroup
|
|
\let\poster@savepage\relax
|
|
\let\shipout\poster@trueshipout
|
|
\setbox\@posterbox\box\voidb@x
|
|
\afterassignment\poster@@pageshipout
|
|
\setbox\@posterbox}
|
|
\def\poster@@pageshipout{%
|
|
\ifvoid\@posterbox\aftergroup\poster@iv\else\poster@iv\fi}
|
|
\let\poster@swapcounters\relax
|
|
|
|
% Make writes immediates, so that they are not repeated.
|
|
\def\posterwrites@true{%
|
|
\let\PosterSaved@write\write
|
|
\let\PosterSaved@read\read
|
|
\let\PosterSaved@openout\openout
|
|
\let\PosterSaved@closeout\closeout
|
|
\def\write{\PosterSaved@write-1{}\immediate\PosterSaved@write}%
|
|
\def\read{\PosterSaved@write-1{}\immediate\PosterSaved@read}%
|
|
\def\openout{\PosterSaved@write-1{}\immediate\PosterSaved@openout}%
|
|
\def\closeout{\PosterSaved@write-1{}\immediate\PosterSaved@closeout}}
|
|
|
|
\def\posternumbering@rowcol{%
|
|
\count\z@=\count\@ne
|
|
\count\@ne=\count\tw@
|
|
\count\tw@=\z@}
|
|
|
|
\def\posternumbering@serial{%
|
|
\count\z@=\poster@cnt
|
|
\count\@ne=\z@
|
|
\count\tw@=\z@}
|
|
|
|
% Save current contents of page in case it contains \special's:
|
|
\def\poster@savepage{%
|
|
\begingroup
|
|
\global\setbox\poster@savedbox\box\voidb@x
|
|
\output{\global\setbox\poster@savedbox\box\@cclv}%
|
|
\par\hbox{}\penalty-10000
|
|
\endgroup
|
|
\ifvoid\poster@savedbox\else
|
|
\dp\poster@savedbox\z@
|
|
\ht\poster@savedbox\z@
|
|
\wd\poster@savedbox\z@
|
|
\fi}
|
|
|
|
% \poster@mag set to decimal value of \mag.
|
|
\def\poster@magtonum{%
|
|
\ifnum\mag=1000
|
|
\def\poster@mag{}%
|
|
\else
|
|
\count@=10000000
|
|
\divide\count@\mag
|
|
\advance\count@ by 200000000
|
|
\expandafter\poster@@magtonum\the\count@
|
|
\fi
|
|
\dimen@=\POSTERcropwidth\relax
|
|
\multiply\dimen@ 100
|
|
\divide\dimen@\mag
|
|
\multiply\dimen@ 10
|
|
\edef\poster@cropwidth{\number\dimen@ sp }}
|
|
|
|
\def\poster@@magtonum#1#2#3#4#5#6#7#8#9{%
|
|
\count@ #2#3#4#5\relax
|
|
\edef\poster@mag{\the\count@.#6#7#8#9}}
|
|
|
|
\def\poster@landscape{%
|
|
\let\next\POSTERpaperheight
|
|
\let\POSTERpaperheight\POSTERpaperwidth
|
|
\let\POSTERpaperwidth\next
|
|
\let\next\POSTERimageheight
|
|
\let\POSTERimageheight\POSTERimagewidth
|
|
\let\POSTERimagewidth\next}
|
|
|
|
% \dimen@ii set to imageheight
|
|
\def\poster@voffsets{%
|
|
\dimen@\POSTERimageheight\relax
|
|
\dimen@ii=\poster@mag\dimen@
|
|
\voffset=\POSTERpaperheight\relax
|
|
\advance\voffset-\dimen@
|
|
\divide\voffset\tw@
|
|
\ifdim\voffset<\z@
|
|
\voffset\z@
|
|
\fi
|
|
\dimen@=\poster@mag\voffset
|
|
\edef\poster@vmargin{\number\dimen@ sp }%
|
|
\advance\voffset\m@ne in
|
|
\voffset=\poster@mag\voffset}
|
|
|
|
% \dimen@i set to imagewidth
|
|
\def\poster@hoffsets{%
|
|
\dimen@\POSTERimagewidth\relax
|
|
\dimen@i=\poster@mag\dimen@
|
|
\hoffset=\POSTERpaperwidth\relax
|
|
\advance\hoffset-\dimen@
|
|
\divide\hoffset\tw@
|
|
\ifdim\hoffset<\z@
|
|
\hoffset=\z@
|
|
\fi
|
|
\dimen@=\poster@mag\hoffset
|
|
\edef\poster@hmargin{\number\dimen@ sp }%
|
|
\advance\hoffset\m@ne in
|
|
\hoffset=\poster@mag\hoffset}
|
|
|
|
% Center vertically
|
|
\def\poster@vcenter{%
|
|
\count@=\ht\@posterbox
|
|
\divide\count@\dimen@ii
|
|
\dimen@=\the\count@\dimen@ii
|
|
\advance\dimen@-\ht\@posterbox
|
|
\ifdim\dimen@<-.1pt
|
|
\advance\count@\@ne
|
|
\fi
|
|
\setbox\@posterbox=\hbox{\vbox to \the\count@\dimen@ii{%
|
|
\vss\box\@posterbox\vss}}}
|
|
|
|
% Center horizontally
|
|
\def\poster@hcenter{%
|
|
\count@=\wd\@posterbox
|
|
\divide\count@\dimen@i
|
|
\dimen@=\the\count@\dimen@i
|
|
\advance\dimen@-\wd\@posterbox
|
|
\ifdim\dimen@<-.1pt
|
|
\advance\count@\@ne
|
|
\fi
|
|
\setbox\@posterbox=\hbox to \the\count@\dimen@i{%
|
|
\hss\box\@posterbox\hss}}
|
|
|
|
% Print rows:
|
|
\def\poster@vloop{%
|
|
\ifdim\ht\@posterbox>.1\p@
|
|
\ifdim\ht\@posterbox<\dimen@ii
|
|
\dimen@ii=\ht\@posterbox
|
|
\poster@makecropbox
|
|
\fi
|
|
\advance\count\@ne\@ne
|
|
\count\tw@=\z@
|
|
\dimen@=\wd\@posterbox
|
|
\poster@hloop
|
|
\dimen@=\ht\@posterbox
|
|
\advance\dimen@-\dimen@ii
|
|
\ht\@posterbox\dimen@
|
|
\expandafter\poster@vloop
|
|
\fi}
|
|
|
|
% Print columns.
|
|
% \dimen@ is used as scratch to keep track of remaining width.
|
|
\def\poster@hloop{%
|
|
\ifdim\dimen@>.1\p@
|
|
\advance\count\tw@ by \@ne
|
|
\begingroup
|
|
\ifdim\dimen@<\dimen@i
|
|
\dimen@i=\dimen@
|
|
\poster@makecropbox
|
|
\fi
|
|
\ifnum\count\@ne=\@ne
|
|
\begingroup
|
|
\advance\dimen@ii.1\p@
|
|
\ifdim\ht\@posterbox>\dimen@ii
|
|
\global\let\next\relax
|
|
\else
|
|
\gdef\next{\count\@ne=\count\tw@ \count\tw@=\z@}%
|
|
\fi
|
|
\endgroup
|
|
\next
|
|
\fi
|
|
\global\advance\poster@cnt\@ne
|
|
\csname posternumbering@\POSTERnumbering\endcsname
|
|
\poster@shipout
|
|
\endgroup
|
|
\advance\dimen@-\dimen@i
|
|
\expandafter\poster@hloop
|
|
\fi}
|
|
|
|
% Shipout, aligning everything at the top-left corner:
|
|
\def\poster@shipout{%
|
|
\shipout\hbox{%
|
|
\ifvoid\poster@savedbox\else\box\poster@savedbox\fi
|
|
\csname beginposterclip@\POSTERclip\endcsname
|
|
\lower\ht\@posterbox\hbox to\z@{%
|
|
\advance\dimen@-\wd\@posterbox
|
|
\kern\dimen@
|
|
\copy\@posterbox
|
|
\hss}%
|
|
\csname endposterclip@\POSTERclip\endcsname
|
|
\copy\poster@cropbox}}%
|
|
|
|
% clip=pstricks
|
|
\def\beginposterclip@pstricks{%
|
|
\expandafter\ifx\csname @pstrickserr\endcsname\relax
|
|
\errmessage{%
|
|
You must load PSTricks to use poster.tex's clip=pstricks option!}%
|
|
\global\let\beginposterclip@pstricks\relax
|
|
\else
|
|
\gdef\beginposterclip@pstricks{\beginposterclip@@pstricks}%
|
|
\gdef\endposterclip@pstricks{\pstVerb{currentpoint initclip moveto}}%
|
|
\beginposterclip@@pstricks
|
|
\fi}
|
|
|
|
\let\endposterclip@pstricks\relax
|
|
|
|
\def\beginposterclip@@pstricks{%
|
|
\pst@Verb{%
|
|
/mtrxc CM def
|
|
\tx@STV
|
|
CP translate
|
|
newpath
|
|
0 0 moveto
|
|
\pst@number\dimen@i 0 rlineto
|
|
0 \pst@number\dimen@ii neg rlineto
|
|
\pst@number\dimen@i neg 0 rlineto
|
|
closepath
|
|
clip
|
|
newpath
|
|
0 0 moveto
|
|
mtrxc setmatrix}}
|
|
|
|
\def\poster@makecropbox{%
|
|
\setbox\poster@cropbox=\hbox{\csname postercrop@\POSTERcrop\endcsname}%
|
|
\ht\poster@cropbox=\z@
|
|
\dp\poster@cropbox=\z@
|
|
\wd\poster@cropbox=\z@}
|
|
|
|
\def\postercrop@corners{%
|
|
\vtop{%
|
|
\hbox{%
|
|
\kern -\poster@hmargin
|
|
\vrule height \poster@cropwidth width \poster@hmargin
|
|
\kern -\poster@cropwidth
|
|
\vrule height \poster@vmargin width \poster@cropwidth
|
|
\kern \dimen@i
|
|
\vrule height \poster@vmargin width \poster@cropwidth
|
|
\kern -\poster@cropwidth
|
|
\vrule height \poster@cropwidth width \poster@hmargin}%
|
|
\nointerlineskip
|
|
\vskip\dimen@ii
|
|
\hbox{%
|
|
\kern -\poster@hmargin
|
|
\vrule height \z@ depth \poster@cropwidth width \poster@hmargin
|
|
\kern -\poster@cropwidth
|
|
\vrule height \z@ depth \poster@vmargin width \poster@cropwidth
|
|
\kern \dimen@i
|
|
\vrule height \z@ depth \poster@vmargin width \poster@cropwidth
|
|
\kern -\poster@cropwidth
|
|
\vrule height \z@ depth \poster@cropwidth width \poster@hmargin}}}%
|
|
|
|
\def\postercrop@full{%
|
|
\begingroup
|
|
\hbox to\z@{%
|
|
\advance\dimen@ii\poster@vmargin
|
|
\kern -\poster@cropwidth
|
|
\vrule height \poster@vmargin depth \dimen@ii width \poster@cropwidth
|
|
\kern \dimen@i
|
|
\vrule height \poster@vmargin depth \dimen@ii width \poster@cropwidth
|
|
\hss}%
|
|
\kern -\poster@hmargin
|
|
\vtop{%
|
|
\advance\dimen@i \poster@hmargin
|
|
\advance\dimen@i \poster@hmargin
|
|
\kern-\poster@cropwidth
|
|
\hrule height \poster@cropwidth width \dimen@i
|
|
\kern\dimen@ii
|
|
\hrule height \z@ depth \poster@cropwidth width \dimen@i}%
|
|
\endgroup}
|
|
|
|
\catcode`\@=\TheAtCode\relax
|
|
\endinput
|
|
%%
|
|
%% END poster.tex
|
|
|