Debian Codegraph @

texmf-dist/tex/generic/poster-mac/poster.tex

raw
1 %% BEGIN poster.tex/poster.sty
2 %%
3 %%
4 %% COPYRIGHT 1993, by Timothy Van Zandt, [email protected]
5 %%
6 %% DESCRIPTION:
7 %% poster.tex/poster.sty contains a macro for making posters and banners
8 %% with TeX. It is compatible with most TeX macro packages, including Plain
9 %% TeX, LaTeX, AmSTeX, and Ams-LaTeX. The only special requirement is that
10 %% your printer not be bothered by text that lies off the page. This is
11 %% true of most printers, including laser printers and PostScript printers.
12 %%
13 %% COPYING:
14 %% This program can be redistributed and/or modified under the terms
15 %% of the LaTeX Project Public License Distributed from CTAN archives
16 %% in directory macros/latex/base/lppl.txt.
17 %%
18 %% CODE:
19 % These macros use TeX primitives, plus the Plain TeX commands:
20 % \dimen@, \dimen@i, \count@, \newcount, \newtoks,
21 %
22 % Check if file is loaded, announce file on terminal, and take care of @:
23 %
24 \def\fileversion{1.1}
25 \def\filedate{10/05/15}
26 \csname PosterLoaded\endcsname
27 \let\PosterLoaded\endinput
28
29 \message{\space\space v\fileversion\space\space\filedate\space\space <tvz>}
30
31 \edef\TheAtCode{\the\catcode`\@}
32 \catcode`\@=11
33
34 \newbox\@posterbox
35 \newbox\poster@savedbox
36 \newbox\poster@cropbox
37
38 \def\POSTERpaperheight{11in}
39 \def\POSTERpaperwidth{8.5in}
40 \def\POSTERimageheight{10in}
41 \def\POSTERimagewidth{7.5in}
42 \def\POSTERlandscape{false}
43 \def\POSTERclip{none}
44 \def\POSTERcrop{corners}
45 \def\POSTERvcenter{false}
46 \def\POSTERhcenter{false}
47
48 \def\poster@set#1[#2]{%
49 \poster@@set#2,=\@nil,%
50 #1}
51 \def\poster@@set#1=#2,{%
52 \ifx\@nil#2\else
53 \expandafter\ifx\csname POSTER#1\endcsname\relax
54 \errmessage{Poster parameter `#1' not defined}%
55 \else
56 \expandafter\edef\csname POSTER#1\endcsname{#2}%
57 \fi
58 \expandafter\poster@@set
59 \fi}
60
61 \def\poster@true{true}
62
63 \def\poster{%
64 \begingroup
65 \futurelet\next\poster@i}
66 \def\poster@i{%
67 \ifx\next[%
68 \expandafter\poster@set
69 \fi
70 \poster@ii}
71 \def\poster@ii{%
72 \afterassignment\poster@iii
73 \setbox\@posterbox=\hbox}
74 \def\poster@iii{\aftergroup\poster@iv}
75 \def\poster@iv{%
76 \setbox\@posterbox=\hbox{\raise\dp\@posterbox\box\@posterbox}%
77 \poster@savepage
78 \poster@magtonum
79 \ifx\POSTERlandscape\poster@true \poster@landscape \fi
80 \poster@hoffsets
81 \poster@voffsets
82 \ifx\POSTERvcenter\poster@true \poster@vcenter \fi
83 \ifx\POSTERhcenter\poster@true \poster@hcenter \fi
84 \poster@makecropbox
85 \count\z@=\z@
86 \poster@vloop
87 \endgroup}
88
89 \def\Poster{%
90 \begingroup
91 \futurelet\next\Poster@i}
92 \def\Poster@i{%
93 \ifx\next[%
94 \expandafter\poster@set
95 \fi
96 \Poster@ii}
97 \def\Poster@ii{%
98 \setbox\@posterbox=\hbox\bgroup\ignorespaces}
99 \def\endPoster{\egroup\poster@iv}
100
101 \def\PosterPage{\futurelet\next\PosterPage@i}
102 \def\PosterPage@i{%
103 \ifx\next[%
104 \expandafter\poster@set
105 \fi
106 \PosterPage@ii}
107 \def\PosterPage@ii{%
108 \count2=\z@
109 \let\poster@trueshipout\shipout
110 \let\shipout\poster@pageshipout}
111 \def\poster@pageshipout{%
112 \begingroup
113 \global\advance\count2\@ne
114 \def\poster@swapcounters{%
115 \count@=\count2
116 \count2=\count1
117 \count1=\count\z@
118 \count\z@=\count@}%
119 \let\poster@savepage\relax
120 \let\shipout\poster@trueshipout
121 \setbox\@posterbox\box\voidb@x
122 \afterassignment\poster@@pageshipout
123 \setbox\@posterbox}
124 \def\poster@@pageshipout{%
125 \ifvoid\@posterbox\aftergroup\poster@iv\else\poster@iv\fi}
126 \let\poster@swapcounters\relax
127
128 % Save current contents of page in case it contains \special's:
129 \def\poster@savepage{%
130 \begingroup
131 \global\setbox\poster@savedbox\box\voidb@x
132 \output{\global\setbox\poster@savedbox\box\@cclv}%
133 \par\hbox{}\penalty-10000
134 \endgroup
135 \ifvoid\poster@savedbox\else
136 \dp\poster@savedbox\z@
137 \ht\poster@savedbox\z@
138 \wd\poster@savedbox\z@
139 \fi}
140
141 % \poster@mag set to decimal value of \mag.
142 \def\poster@magtonum{%
143 \ifnum\mag=1000
144 \def\poster@mag{}%
145 \else
146 \count@=10000000
147 \divide\count@\mag
148 \advance\count@ by 200000000
149 \expandafter\poster@@magtonum\the\count@
150 \fi
151 \dimen@=2000pt
152 \divide\dimen@\mag
153 \edef\poster@cropwidth{\number\dimen@ sp }}
154
155 \def\poster@@magtonum#1#2#3#4#5#6#7#8#9{%
156 \count@ #2#3#4#5\relax
157 \edef\poster@mag{\the\count@.#6#7#8#9}}
158
159 \def\poster@landscape{%
160 \let\next\POSTERpaperheight
161 \let\POSTERpaperheight\POSTERpaperwidth
162 \let\POSTERpaperwidth\next
163 \let\next\POSTERimageheight
164 \let\POSTERimageheight\POSTERimagewidth
165 \let\POSTERimagewidth\next}
166
167 % \dimen@ii set to imageheight
168 \def\poster@voffsets{%
169 \dimen@\POSTERimageheight\relax
170 \dimen@ii=\poster@mag\dimen@
171 \voffset=\POSTERpaperheight\relax
172 \advance\voffset-\dimen@
173 \divide\voffset 2
174 \ifdim\voffset<\z@
175 \voffset\z@
176 \fi
177 \dimen@=\poster@mag\voffset
178 \edef\poster@vmargin{\number\dimen@ sp }%
179 \advance\voffset-1in
180 \voffset=\poster@mag\voffset}
181
182 % \dimen@i set to imagewidth
183 \def\poster@hoffsets{%
184 \dimen@\POSTERimagewidth\relax
185 \dimen@i=\poster@mag\dimen@
186 \hoffset=\POSTERpaperwidth\relax
187 \advance\hoffset-\dimen@
188 \divide\hoffset 2
189 \ifdim\hoffset<\z@
190 \hoffset=\z@
191 \fi
192 \dimen@=\poster@mag\hoffset
193 \edef\poster@hmargin{\number\dimen@ sp }%
194 \advance\hoffset-1in
195 \hoffset=\poster@mag\hoffset}
196
197 % Center vertically
198 \def\poster@vcenter{%
199 \count@=\ht\@posterbox
200 \divide\count@\dimen@ii
201 \dimen@=\the\count@\dimen@ii
202 \advance\dimen@-\ht\@posterbox
203 \ifdim\dimen@<-.1pt
204 \advance\count@ 1
205 \fi
206 \setbox\@posterbox=\hbox{\vbox to \the\count@\dimen@ii{%
207 \vss\box\@posterbox\vss}}}
208
209 % Center horizontally
210 \def\poster@hcenter{%
211 \count@=\wd\@posterbox
212 \divide\count@\dimen@i
213 \dimen@=\the\count@\dimen@i
214 \advance\dimen@-\wd\@posterbox
215 \ifdim\dimen@<-.1pt
216 \advance\count@ 1
217 \fi
218 \setbox\@posterbox=\hbox to \the\count@\dimen@i{%
219 \hss\box\@posterbox\hss}}
220
221 % Print rows:
222 \def\poster@vloop{%
223 \ifdim\ht\@posterbox>.1pt
224 \ifdim\ht\@posterbox<\dimen@ii
225 \dimen@ii=\ht\@posterbox
226 \poster@makecropbox
227 \fi
228 \advance\count\z@ 1
229 \count1=\z@
230 \dimen@=\wd\@posterbox
231 \poster@hloop
232 \dimen@=\ht\@posterbox
233 \advance\dimen@-\dimen@ii
234 \ht\@posterbox\dimen@
235 \expandafter\poster@vloop
236 \fi}
237
238 % Print columns.
239 % \dimen@ is used as scratch to keep track of remaining width.
240 \def\poster@hloop{%
241 \ifdim\dimen@>.1pt
242 \advance\count1 by 1
243 \begingroup
244 \ifdim\dimen@<\dimen@i
245 \dimen@i=\dimen@
246 \poster@makecropbox
247 \fi
248 \poster@swapcounters
249 \poster@shipout
250 \endgroup
251 \advance\dimen@-\dimen@i
252 \expandafter\poster@hloop
253 \fi}
254
255 % Shipout, aligning everything at the top-left corner:
256 \def\poster@shipout{%
257 \shipout\hbox{%
258 \ifvoid\poster@savedbox\else\box\poster@savedbox\fi
259 \csname beginposterclip@\POSTERclip\endcsname
260 \lower\ht\@posterbox\hbox to\z@{%
261 \advance\dimen@-\wd\@posterbox
262 \kern\dimen@
263 \copy\@posterbox
264 \hss}%
265 \csname endposterclip@\POSTERclip\endcsname
266 \copy\poster@cropbox}}%
267
268 % clip=pstricks
269 \def\beginposterclip@pstricks{%
270 \expandafter\ifx\csname @pstrickserr\endcsname\relax
271 \errmessage{%
272 You must load PSTricks to use poster.tex's clip=pstricks option!}%
273 \global\let\beginposterclip@pstricks\relax
274 \else
275 \gdef\beginposterclip@pstricks{\beginposterclip@@pstricks}%
276 \gdef\endposterclip@pstricks{\pstVerb{currentpoint initclip moveto}}%
277 \beginposterclip@@pstricks
278 \fi}
279
280 \let\endposterclip@pstricks\relax
281
282 \def\beginposterclip@@pstricks{%
283 \pst@Verb{%
284 /mtrxc CM def
285 \tx@STV
286 CP translate
287 newpath
288 0 0 moveto
289 \pst@number\dimen@i 0 rlineto
290 0 \pst@number\dimen@ii neg rlineto
291 \pst@number\dimen@i neg 0 rlineto
292 closepath
293 clip
294 newpath
295 0 0 moveto
296 mtrxc setmatrix}}
297
298 \def\poster@makecropbox{%
299 \setbox\poster@cropbox=\hbox{\csname postercrop@\POSTERcrop\endcsname}%
300 \ht\poster@cropbox=\z@
301 \dp\poster@cropbox=\z@
302 \wd\poster@cropbox=\z@}
303
304 \def\postercrop@corners{%
305 \vtop{%
306 \hbox{%
307 \kern -\poster@hmargin
308 \vrule height \poster@cropwidth width \poster@hmargin
309 \kern -\poster@cropwidth
310 \vrule height \poster@vmargin width \poster@cropwidth
311 \kern \dimen@i
312 \vrule height \poster@vmargin width \poster@cropwidth
313 \kern -\poster@cropwidth
314 \vrule height \poster@cropwidth width \poster@hmargin}%
315 \nointerlineskip
316 \vskip\dimen@ii
317 \hbox{%
318 \kern -\poster@hmargin
319 \vrule height \z@ depth \poster@cropwidth width \poster@hmargin
320 \kern -\poster@cropwidth
321 \vrule height \z@ depth \poster@vmargin width \poster@cropwidth
322 \kern \dimen@i
323 \vrule height \z@ depth \poster@vmargin width \poster@cropwidth
324 \kern -\poster@cropwidth
325 \vrule height \z@ depth \poster@cropwidth width \poster@hmargin}}}%
326
327 \def\postercrop@full{%
328 \begingroup
329 \hbox to\z@{%
330 \advance\dimen@ii\poster@vmargin
331 \kern -\poster@cropwidth
332 \vrule height \poster@vmargin depth \dimen@ii width \poster@cropwidth
333 \kern \dimen@i
334 \vrule height \poster@vmargin depth \dimen@ii width \poster@cropwidth
335 \hss}%
336 \kern -\poster@hmargin
337 \vtop{%
338 \advance\dimen@i \poster@hmargin
339 \advance\dimen@i \poster@hmargin
340 \kern-\poster@cropwidth
341 \hrule height \poster@cropwidth width \dimen@i
342 \kern\dimen@ii
343 \hrule height \z@ depth \poster@cropwidth width \dimen@i}%
344 \endgroup}
345
346 \catcode`\@=\TheAtCode\relax
347 \endinput
348 %%
349 %% END poster.tex