blob: 74776abfaaa48817c03b4045b48ac0569622d7e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
%%
%% This is file `olabels.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% labels.dtx (with options: `package,latex209')
%% Originally copyright (C) 1993-1994-1995-1998 by Sebastian Rahtz
%% and Grant Gustafson
%% Copyright (C) 2002-2003 by Julian Gilbey <jdg@debian.org>
%%
%% This program may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% This program consists of the files labels.dtx and labels.ins
%% together with the generated files labels.sty and olabels.sty.
%%
%% File: labels.dtx
%% Originally copyright (C) 1993-1994-1995-1998 by Sebastian Rahtz
%% and Grant Gustafson
%% Copyright (C) 2002-2003 by Julian Gilbey <jdg@debian.org>
\NeedsTeXFormat{LaTeX2e}
\newdimen\paperwidth
\paperwidth=8.5in% 297mm for a4paper
\newdimen\paperheight
\paperheight=11in% 210mm for a4paper
\def\settoheight#1#2{\setbox\@tempboxa%
\hbox{#2}#1\ht\@tempboxa\setbox\@tempboxa\box\voidb@x}
\def\PackageWarning#1#2{\typeout{#1: #2}}
\newif\iflabel@traddimens
\label@traddimenstrue
\newcount\LabelCols
\newcount\LabelRows
\iflabel@traddimens
\newdimen\LeftBorder
\newdimen\RightBorder
\newdimen\TopBorder
\newdimen\BottomBorder
\else
\newdimen\LeftPageMargin
\newdimen\RightPageMargin
\newdimen\TopPageMargin
\newdimen\BottomPageMargin
\newdimen\InterLabelColumn
\newdimen\InterLabelRow
\newdimen\LeftLabelBorder
\newdimen\RightLabelBorder
\newdimen\TopLabelBorder
\newdimen\BottomLabelBorder
\fi
\newcount\numberoflabels
\newdimen\label@width
\newdimen\label@height
\newdimen\area@width
\newdimen\area@height
\newdimen\half@label
\newdimen\half@area
\newdimen\addr@width
\newdimen\LabTmp
\newsavebox\this@label
\newcount\label@number
\newcount\skip@labels
\newcount\l@so@far
\newcount\LabelTotal
\newif\ifLabelGrid
\newif\iffirst@label
\newif\ifLabelInfo
\first@labeltrue
\LabelGridfalse
\LabelInfofalse
\ifdim\paperwidth=210mm\relax%
\LabelCols=3\relax\LabelRows=8\relax% a4paper
\else
\LabelCols=3\relax\LabelRows=7\relax% letterpaper
\fi%
\iflabel@traddimens
\LeftBorder=8mm
\RightBorder=8mm
\TopBorder=9mm
\BottomBorder=2mm
\else
\LeftPageMargin=4mm
\RightPageMargin=4mm
\TopPageMargin=5mm
\BottomPageMargin=5mm
\InterLabelColumn=0mm
\InterLabelRow=0mm
\LeftLabelBorder=5mm
\RightLabelBorder=5mm
\TopLabelBorder=4mm
\BottomLabelBorder=4mm
\fi
\textwidth=\paperwidth
\textheight=\paperheight
\topmargin=-1in
\headheight=0em
\headsep=0em
\topskip=0em
\footskip=0em
\oddsidemargin=-1in
\evensidemargin=-1in
\pagestyle{empty}
\parindent=0em
\parskip=0pt
\iflabel@traddimens
\def\@LabelSetup{%
\global\label@width\textwidth
\global\divide\label@width by\LabelCols
\global\label@height\textheight
\global\advance\label@height by-\TopBorder
\global\advance\label@height by-\BottomBorder
\global\divide\label@height by\LabelRows
\global\topmargin=-1in\global\advance\topmargin by\TopBorder
\global\area@width=\label@width
\global\advance\area@width by -\LeftBorder
\global\advance\area@width by -\RightBorder
\ifLabelGrid%
\global\advance\area@width by-2\fboxsep
\global\advance\area@width by-2\fboxrule
\fi
\ifLabelGrid
\global\advance\label@height by-2\fboxsep
\global\advance\label@height by-2\fboxrule
\fi
\global\half@label=\label@height\divide\half@label by2\relax
\global\label@number=1\relax
}
\else
\def\@LabelSetup{%
\global\label@width\textwidth
\global\advance\label@width by-\LeftPageMargin
\global\advance\label@width by-\RightPageMargin
\global\advance\label@width by-\LabelCols\InterLabelColumn
\global\advance\label@width by\InterLabelColumn
\global\divide\label@width by\LabelCols
\ifdim\label@width<0pt
\PackageWarning{labels}{Some dimensions are silly: label width
\the\label@width~is negative!}
\label@width=0pt
\fi
\global\label@height\textheight
\global\advance\label@height by-\TopPageMargin
\global\advance\label@height by-\BottomPageMargin
\global\advance\label@height by-\LabelRows\InterLabelRow
\global\advance\label@height by\InterLabelRow
\global\divide\label@height by\LabelRows
\ifdim\label@height<0pt
\PackageWarning{labels}{Some dimensions are silly: label height
\the\label@height~is negative!}
\label@height=0pt
\fi
\global\topmargin=-1in\global\advance\topmargin by\TopPageMargin
\global\oddsidemargin=-1in\global\advance\oddsidemargin by\LeftPageMargin
\global\evensidemargin=\oddsidemargin
\global\area@width=\label@width
\global\advance\area@width by -\LeftLabelBorder
\global\advance\area@width by -\RightLabelBorder
\global\area@height=\label@height
\global\advance\area@height by -\TopLabelBorder
\global\advance\area@height by -\BottomLabelBorder
\global\half@label=\label@height\divide\half@label by 2\relax
\global\half@area=\area@height\divide\half@area by 2\relax
\global\label@number=1\relax
}
\fi
\def\LabelSetup{\@LabelSetup
\ifLabelInfo
\typeout{Control sequences adjustable in the preamble:}
\typeout{\LabelRows=\the\LabelRows}
\typeout{\LabelCols=\the\LabelCols}
\iflabel@traddimens
\typeout{The newdimens option was not selected; the used parameters are:}
\TypeoutBlurb{\TopBorder}{\TopBorder}
\TypeoutBlurb{\BottomBorder}{\BottomBorder}
\TypeoutBlurb{\LeftBorder}{\LeftBorder}
\TypeoutBlurb{\RightBorder}{\RightBorder}
\else
\typeout{The newdimens option was selected; the used parameters are:}
\TypeoutBlurb{\TopPageMargin}{\TopPageMargin}
\TypeoutBlurb{\BottomPageMargin}{\BottomPageMargin}
\TypeoutBlurb{\LeftPageMargin}{\LeftPageMargin}
\TypeoutBlurb{\RightPageMargin}{\RightPageMargin}
\TypeoutBlurb{\InterLabelColumn}{\InterLabelColumn}
\TypeoutBlurb{\InterLabelRow}{\InterLabelRow}
\TypeoutBlurb{\TopLabelBorder}{\TopLabelBorder}
\TypeoutBlurb{\BottomLabelBorder}{\BottomLabelBorder}
\TypeoutBlurb{\LeftLabelBorder}{\LeftLabelBorder}
\TypeoutBlurb{\RightLabelBorder}{\RightLabelBorder}
\fi
\typeout{Computed values:}
\TypeoutBlurb{Label Width}{\label@width}
\TypeoutBlurb{Label Height}{\label@height}
\else
\typeout{To print info, put `\protect\LabelInfotrue' in the preamble}
\fi
}
\numberoflabels=1%
\def\sticky@label{\l@so@far=0%
\loop\ifnum\l@so@far<\numberoflabels\advance\l@so@far by 1\make@label%
\repeat}
\def\make@label{%
\ifnum\LabelTotal=0\vfill\eject\LabelTotal=\LabelRows\relax
\multiply\LabelTotal by \LabelCols\fi
\advance\LabelTotal by -1\relax
\ifLabelGrid
\let\boxing@type\framebox
\else
\let\boxing@type\makebox
\fi
\settowidth{\LabTmp}{\usebox{\this@label}}%
\ifdim\LabTmp=0cm\let\action=\relax\else\let\action=\BuildB@x\fi
%\TypeoutBlurb{Box Width}{\LabTmp}%
\advance\LabTmp by -\area@width
\ifdim\LabTmp>0cm\relax
\PkgBlurb{Label too wide}{\LabTmp}\fi
\settoheight{\LabTmp}%
{\begin{tabular}{l}\usebox{\this@label}\end{tabular}}%
%\TypeoutBlurb{Box height}{\LabTmp}%
\iflabel@traddimens\advance\LabTmp by -\half@label
\else\advance\LabTmp by -\half@area\fi
\ifdim\LabTmp>0cm\relax
\LabTmp=2\LabTmp\PkgBlurb{Label too tall}{\LabTmp}\fi
\ifnum\skip@labels<\sk@pped\let\action=\BuildB@x\fi
\action
}
\def\BuildB@x{%
\iflabel@traddimens
\boxing@type[\label@width][c]{%
\rule{0pt}{\label@height}%
\raisebox{\half@label}[0pt][0pt]{%
\rule{\LeftBorder}{0pt}%
\usebox{\this@label}%
\rule{\RightBorder}{0pt}%
}}%
\else
\begingroup
\fboxsep=-\fboxrule
\boxing@type{%
\vbox to \label@height{%
\vskip\TopLabelBorder
\vss
\hbox to \label@width{%
\hskip\LeftLabelBorder
\usebox{\this@label}%
\hss
}%
\vss
\vskip\BottomLabelBorder
}%
}%
\endgroup
\fi
\ifnum\skip@labels<\sk@pped\message{x}\else\message{+}\fi
\ifnum\label@number=\LabelCols
\message{|}%
\endgraf\nointerlineskip
\iflabel@traddimens\else\vskip\InterLabelRow\fi
\global\label@number=1
\else\global\advance\label@number by 1
\iflabel@traddimens\else\hskip\InterLabelColumn\fi
\fi
}
\newcount\@Milli
\def\ToMilli#1{\@Milli=#1\advance\@Milli by93225\relax
\divide\@Milli by 186450\relax}
\def\PkgBlurb#1#2{\ToMilli{#2}%
\PackageWarning{labels}{#1 by \the\@Milli mm (\the #2)}%
}
\def\TypeoutBlurb#1#2{\ToMilli{#2}%
\typeout{#1=\the\@Milli mm (\the #2)}%
}
\newcommand{\genericlabel}[1]{%
\iffirst@label\LabelSetup\first@labelfalse\fi%
\savebox{\this@label}{#1}\sticky@label\@gobblecr}
\long\def\L@dblarg#1{\@ifnextchar[{#1}{\L@xdblarg{#1}}}
\long\def\L@xdblarg#1#2{#1[]{#2}}
\long\def\addresslabel{\L@dblarg{\@addresslabel}}
\long\def\@addresslabel[#1]#2{\genericlabel{#1%
\begin{tabular}{@{}p{\area@width}@{}}\raggedright #2\end{tabular}}}
\long\def\boxedaddresslabel{\L@dblarg{\@boxedaddresslabel}}
\long\def\@boxedaddresslabel[#1]#2{\genericlabel{#1%
\addr@width=\area@width\advance\addr@width by-2\fboxsep%
\advance\addr@width by-2\fboxrule\fbox{%
\begin{tabular}{@{}p{\addr@width}@{}}\raggedright #2\end{tabular}}}}
\long\def\labels
{\iffirst@label\LabelSetup\first@labelfalse\fi\start@@label}
\def\endlabels{\end@@label}
\def\start@@label{%
\begin{lrbox}{\this@label}%
\begin{minipage}{\area@width}\raggedright%
\catcode `\^^M =\active\@gobblecr%
}
\def\end@@label{%
\end{minipage}\end{lrbox}%
\sticky@label}
\def\start@newline{\mbox{}\expandafter\newline}%
\def\new@label{\end@@label\start@@label}%
\catcode `\^^M = \active%
\def ^^M{\futurelet\nexttoken\isitapar}%
\def\isitapar{\ifx^^M\nexttoken\let\action=\new@label\else%
\let\action\start@newline\fi\action}%
\catcode `\^^M = 5\relax%
\def\labelfile#1{\begin{labels}\input#1\end{labels}}
\def\promptlabels{\typein[\labelfilename]{What is the name of the
label file?}
\labelfile{\labelfilename}}
\newcount\sk@pped
\def\skiplabels#1{\sk@pped=#1%
\savebox{\this@label}{\rule{0pt}{.5in}}%
\skip@labels=0\relax
\loop\ifnum\skip@labels<\sk@pped\make@label%
\advance\skip@labels by 1\relax\repeat}
\endinput
%%
%% End of file `olabels.sty'.
|