posaune
[projects.git] / tools / tex / wallpaper.sty
1 %% 
2 %% This is file `wallpaper.sty' v 1.10
3 %%
4 %% Author Michael H.F. Wilkinson 
5 %%   April 21, 2006
6 %% 
7 %% Create background, either centered, tiled, or in any corner   
8 %% relies heavily on eso-pic.sty, corrects for changes in \hoffset 
9 %% by classes such as sciposter.cls
10 %% Problems, bugs and comments to 
11 %%        michael@cs.rug.nl
12 %% version 1.10, 2006/04/21:
13 %%               - Commands added for corner wallpapers 
14 %%
15 %% version 1.01, 2005/01/18:
16 %%               - \providecommand{\LenToUnit} included to be compatible
17 %%                  with earlier versions of eso-pic.sty
18 %%
19 %% version 1.00, 2004/12/22:
20 %%               - first release
21 %%
22 %%
23 \ProvidesPackage{wallpaper}[2005/01/18, v1.01 easy wallpaper formatting (MHFW)]
24 \NeedsTeXFormat{LaTeX2e}[1995/06/01]
25
26 \RequirePackage{ifthen}
27 \RequirePackage{calc}
28 \RequirePackage{eso-pic}
29 \RequirePackage{graphicx}
30
31 \providecommand{\LenToUnit}[1]{#1\@gobble}
32
33
34 \newlength{\wpXoffset}
35 \setlength{\wpXoffset}{-\hoffset}
36 \newlength{\wpYoffset}
37 \setlength{\wpYoffset}{0pt}
38 \newlength{\tileXoffset}
39 \newlength{\tileYoffset}
40 \newlength{\tilewidth}
41 \newlength{\tileheight}
42 \newlength{\tileX}
43 \newlength{\tileY}
44
45 \newcommand{\LLCornerWallPaper}[2]{%
46 \AddToShipoutPicture{%
47   \AtPageLowerLeft{%
48     \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
49                      keepaspectratio]{#2}%
50     }
51   }
52 }
53
54 \newcommand{\ThisLLCornerWallPaper}[2]{%
55 \AddToShipoutPicture*{%
56   \AtPageLowerLeft{%
57     \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
58                      keepaspectratio]{#2}%
59     }
60   }
61 }
62
63 \newcommand{\ULCornerWallPaper}[2]{%
64   \AddToShipoutPicture{%
65     \AtPageLowerLeft{%
66       \parbox[b][\paperheight]{#1\paperwidth}{%       
67         \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
68         keepaspectratio]{#2}%
69         \vfill%
70       }
71     }
72   }
73 }
74
75 \newcommand{\ThisULCornerWallPaper}[2]{%
76   \AddToShipoutPicture*{%
77     \AtPageLowerLeft{%
78       \parbox[b][\paperheight]{#1\paperwidth}{%       
79         \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
80         keepaspectratio]{#2}%
81         \vfill%
82       }
83     }
84   }
85 }
86
87 \newcommand{\LRCornerWallPaper}[2]{%
88   \AddToShipoutPicture{%
89     \AtPageLowerLeft{%
90       \parbox[b]{\paperwidth}{%       
91         \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
92         keepaspectratio]{#2}%
93       }
94     }
95   }
96 }
97
98 \newcommand{\ThisLRCornerWallPaper}[2]{%
99   \AddToShipoutPicture*{%
100     \AtPageLowerLeft{%
101       \parbox[b]{\paperwidth}{%       
102         \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
103         keepaspectratio]{#2}%
104       }
105     }
106   }
107 }
108
109 \newcommand{\URCornerWallPaper}[2]{%
110   \AddToShipoutPicture{%
111     \AtPageLowerLeft{%
112       \parbox[b][\paperheight]{\paperwidth}{%       
113         \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
114         keepaspectratio]{#2}%
115         \vfill%
116       }
117     }
118   }
119 }
120 \newcommand{\ThisURCornerWallPaper}[2]{%
121   \AddToShipoutPicture*{%
122     \AtPageLowerLeft{%
123       \parbox[b][\paperheight]{\paperwidth}{%       
124         \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
125         keepaspectratio]{#2}%
126         \vfill%
127       }
128     }
129   }
130 }
131
132 \newcommand{\CenterWallPaper}[2]{%
133 \AddToShipoutPicture{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
134      \parbox[b][\paperheight]{\paperwidth}{%       
135        \vfill
136        \centering
137        \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
138                         keepaspectratio]{#2}%
139        \vfill
140      }}
141   }
142 }  
143
144 \newcommand{\ThisCenterWallPaper}[2]{%
145 \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
146      \parbox[b][\paperheight]{\paperwidth}{%       
147        \vfill
148        \centering
149        \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
150                         keepaspectratio]{#2}%
151        \vfill
152      }}}
153 }  
154
155
156
157 \newcommand{\TileSquareWallPaper}[2]{%
158 \AddToShipoutPicture{%
159   \begingroup
160     \setlength{\tileYoffset}{\wpYoffset}
161     \setlength{\tilewidth}{\paperwidth/#1}%
162     \setlength{\tileheight}{\tilewidth}%
163     \setlength{\tileY}{0pt}%
164     \whiledo{\lengthtest{\tileY < \paperheight}}{% 
165       \setlength{\tileX}{0pt}%
166       \setlength{\tileXoffset}{\wpXoffset}%
167       \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
168         \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
169           \includegraphics[height=\tileheight,width=\tilewidth]{#2}}%
170         \addtolength{\tileX}{\tilewidth}
171         \addtolength{\tileXoffset}{\tilewidth}
172       }%
173       \addtolength{\tileY}{\tileheight}
174       \addtolength{\tileYoffset}{\tileheight}
175     }%
176   \endgroup  
177 }%
178 }
179
180 \newcommand{\ThisTileSquareWallPaper}[2]{%
181 \AddToShipoutPicture*{%
182   \begingroup
183     \setlength{\tileYoffset}{\wpYoffset}
184     \setlength{\tilewidth}{\paperwidth/#1}%
185     \setlength{\tileheight}{\tilewidth}%
186     \setlength{\tileY}{0pt}%
187     \whiledo{\lengthtest{\tileY < \paperheight}}{% 
188       \setlength{\tileX}{0pt}%
189       \setlength{\tileXoffset}{\wpXoffset}%
190       \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
191         \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
192           \includegraphics[height=\tileheight,width=\tilewidth]{#2}}%
193         \addtolength{\tileX}{\tilewidth}
194         \addtolength{\tileXoffset}{\tilewidth}
195       }%
196       \addtolength{\tileY}{\tileheight}
197       \addtolength{\tileYoffset}{\tileheight}
198     }%
199   \endgroup  
200 }%
201 }
202
203
204 \newcommand{\TileWallPaper}[3]{%
205 \AddToShipoutPicture{%
206   \begingroup
207     \setlength{\tileYoffset}{\wpYoffset}
208     \setlength{\tilewidth}{#1}%
209     \setlength{\tileheight}{#2}%
210     \setlength{\tileY}{0pt}%
211     \whiledo{\lengthtest{\tileY < \paperheight}}{% 
212       \setlength{\tileX}{0pt}%
213       \setlength{\tileXoffset}{\wpXoffset}%
214       \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
215         \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
216           \includegraphics[height=\tileheight,width=\tilewidth]{#3}}%
217         \addtolength{\tileX}{\tilewidth}
218         \addtolength{\tileXoffset}{\tilewidth}
219       }%
220       \addtolength{\tileY}{\tileheight}
221       \addtolength{\tileYoffset}{\tileheight}
222     }%
223   \endgroup  
224 }%
225 }
226
227 \newcommand{\ThisTileWallPaper}[3]{%
228 \AddToShipoutPicture*{%
229   \begingroup
230     \setlength{\tileYoffset}{\wpYoffset}
231     \setlength{\tilewidth}{#1}%
232     \setlength{\tileheight}{#2}%
233     \setlength{\tileY}{0pt}%
234     \whiledo{\lengthtest{\tileY < \paperheight}}{% 
235       \setlength{\tileX}{0pt}%
236       \setlength{\tileXoffset}{\wpXoffset}%
237       \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
238         \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
239           \includegraphics[height=\tileheight,width=\tilewidth]{#3}}%
240         \addtolength{\tileX}{\tilewidth}
241         \addtolength{\tileXoffset}{\tilewidth}
242       }%
243       \addtolength{\tileY}{\tileheight}
244       \addtolength{\tileYoffset}{\tileheight}
245     }%
246   \endgroup  
247 }%
248 }
249
250 \newcommand{\ClearWallPaper}{\ClearShipoutPicture}