diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/poster/poster.tex |
Initial commit
Diffstat (limited to 'macros/generic/poster/poster.tex')
-rw-r--r-- | macros/generic/poster/poster.tex | 349 |
1 files changed, 349 insertions, 0 deletions
diff --git a/macros/generic/poster/poster.tex b/macros/generic/poster/poster.tex new file mode 100644 index 0000000000..0265818b9c --- /dev/null +++ b/macros/generic/poster/poster.tex @@ -0,0 +1,349 @@ +%% BEGIN poster.tex/poster.sty +%% +%% +%% 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. +%% +%% COPYING: +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% CODE: +% These macros use TeX primitives, plus the Plain TeX commands: +% \dimen@, \dimen@i, \count@, \newcount, \newtoks, +% +% Check if file is loaded, announce file on terminal, and take care of @: +% +\def\fileversion{1.1} +\def\filedate{10/05/15} +\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 + +\def\POSTERpaperheight{11in} +\def\POSTERpaperwidth{8.5in} +\def\POSTERimageheight{10in} +\def\POSTERimagewidth{7.5in} +\def\POSTERlandscape{false} +\def\POSTERclip{none} +\def\POSTERcrop{corners} +\def\POSTERvcenter{false} +\def\POSTERhcenter{false} + +\def\poster@set#1[#2]{% + \poster@@set#2,=\@nil,% + #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{% + \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\z@=\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{% + \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{% + \count2=\z@ + \let\poster@trueshipout\shipout + \let\shipout\poster@pageshipout} +\def\poster@pageshipout{% + \begingroup + \global\advance\count2\@ne + \def\poster@swapcounters{% + \count@=\count2 + \count2=\count1 + \count1=\count\z@ + \count\z@=\count@}% + \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 + +% 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@=2000pt + \divide\dimen@\mag + \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 2 + \ifdim\voffset<\z@ + \voffset\z@ + \fi + \dimen@=\poster@mag\voffset + \edef\poster@vmargin{\number\dimen@ sp }% + \advance\voffset-1in + \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 2 + \ifdim\hoffset<\z@ + \hoffset=\z@ + \fi + \dimen@=\poster@mag\hoffset + \edef\poster@hmargin{\number\dimen@ sp }% + \advance\hoffset-1in + \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@ 1 + \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@ 1 + \fi + \setbox\@posterbox=\hbox to \the\count@\dimen@i{% + \hss\box\@posterbox\hss}} + +% Print rows: +\def\poster@vloop{% + \ifdim\ht\@posterbox>.1pt + \ifdim\ht\@posterbox<\dimen@ii + \dimen@ii=\ht\@posterbox + \poster@makecropbox + \fi + \advance\count\z@ 1 + \count1=\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@>.1pt + \advance\count1 by 1 + \begingroup + \ifdim\dimen@<\dimen@i + \dimen@i=\dimen@ + \poster@makecropbox + \fi + \poster@swapcounters + \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 |