Debian Codegraph @

texmf-dist/source/latex/flabels/flabels.dtx

raw
1 % \iffalse
2 %% File: flabels.dtx
3 %% Copyright (C) 1997,1999 Volker B"orchers
4 %% This program can be redistributed and/or modified under the terms
5 %% of the LaTeX Project Public License Distributed from CTAN
6 %% archives in directory macros/latex/base/lppl.txt; either
7 %% version 1 of the License, or any later version.
8 %
9 %<package>\NeedsTeXFormat{LaTeX2e}
10 %<package>\ProvidesPackage{flabels}
11 %<package>[1999/05/19 v1.0 Macros for file/binder labels]
12 %
13 %<*driver>
14 \documentclass{ltxdoc}
15 \usepackage[nice]{flabels}
16 \GetFileInfo{flabels.sty}
17 \begin{document}
18 \title{The \textsf{flabels} package\thanks{This file has version number
19 \fileversion, dated \filedate.}}
20 \author{Volker B\"orchers\thanks{email: [email protected]}\\
21 Universit\"at Bremen}
22 \date{\filedate}
23 \maketitle
24 \DocInput{flabels.dtx}
25 \end{document}
26 %</driver>
27 % \fi
28 %\iffalse
29 %
30 %% Package `flabels' to use with LaTeX2e
31 %
32 % Version: Date: Changes:
33 %
34 % 1.0 1997/07/16 First working version for "Leitz-Ordner"
35 % optionally including color
36 % 1999/05/19 Only change: added licence informations
37 %\fi
38 %
39 %
40 % \DoNotIndex{\advance,\box,\CurrentOption,\DeclareOption,\def}
41 % \DoNotIndex{\else,\fi,\hrule,\hspace,\newdimen,\newif}
42 % \DoNotIndex{\ifnum,\loop,\MessageBreak,\newcount,\divide}
43 % \DoNotIndex{\PackageWarning,\ProcessOptions,\relax,\repeat}
44 % \DoNotIndex{\color,\textcolor,\colorbox,\begin,\end,\endinput}
45 % \DoNotIndex{\framebox,Rest,\huge,\line,\linethickness,\makebox}
46 % \DoNotIndex{\multiput,\newsavebox,\parbox,\protect,\put,\RequirePackage}
47 % \DoNotIndex{\savebox,\thinlines,\thicklines,\usebox,\setlength}
48 % \DoNotIndex{\l@itztrue,\l@itztrue,\f@llheighttrue,\n@rrowtrue}
49 % \DoNotIndex{\f@llheighttrue,\n@rrowtrue}
50 % \DoNotIndex{\colorl@beltrue,\be@nicetrue,\no@holetrue}
51 % \DoNotIndex{\l@itzfalse,\l@itzfalse,\f@llheightfalse,\n@rrowfalse}
52 % \DoNotIndex{\f@llheightfalse,\n@rrowfalse}
53 % \DoNotIndex{\colorl@belfalse,\be@nicefalse,\no@holefalse}
54 %
55 % \CheckSum{368}
56 %
57 % \begin{abstract}
58 % This package provides macros for typesetting pretty labels
59 % (optionally colored) for the back of files or binders. So far
60 % they are only applicable for the special format of the (for
61 % a4 paper) widely used ``Leitz-Ordner'' (ring binder). We use 2
62 % macros, the first one for a number of empty labels (for
63 % handwriting) while the second contains a text field.
64 % \end{abstract}
65 %
66 % \tableofcontents
67 %
68 % \section{Introduction}
69 % Thanks to photo-copiers a lot of paper is produced that has to be kept
70 % somewhere and (perhaps) even in some order. If you want to keep an
71 % overview over it you will punch it and put it into a file/binder
72 % (otherwise one or more stacks will do). This package have been
73 % invented to make life with this binders a little bit nicer, prettier
74 % and more colored.
75 %
76 % The |flabels| (`filelabels') package provides two macros for
77 % producing labels for the back of a binder in the wide-spread format
78 % (for a4 paper!) 28.3 $\times$ 31.8 cm (11.1 $\times$ 12.5 inch) with
79 % the back height 31.8 cm (12.5 inch) and different available widths.
80 %
81 % \newlength{\mytextwidth}\setlength{\mytextwidth}{\textwidth}
82 % \addtolength{\mytextwidth}{-2\fboxsep}
83 % \smallskip\noindent
84 % \fbox{\parbox{\mytextwidth}{I hope that further
85 % versions of the |flabels| package will support more than one
86 % binder format. (But this will depend on \emph{You}, the
87 % friendly reader who want to contribute to |flabels| by adding
88 % support for \emph{Your} favourite binder \texttt{:-)}.}}
89 %
90 %
91 % \section{Using the flabels package}
92 % Invoke the |flabels| package by requesting it in the
93 % preamble (Note that this package requires \LaTeXe!):
94 %
95 % |\usepackage[...]{flabels}|
96 %
97 %
98 % \subsection{Quick start}\label{sec:quick}
99 % \begin{itemize}
100 % \item Use option |a4paper| if you need it.
101 % \item Check the format of the binder you have: If the label should be
102 % 37mm wide choose option |narrow|; the \emph{default} width is 60mm.
103 % \item Decide if you want large labels (full height of the binder back).
104 % If you do include option |fullheight| in the |usepackage| command.
105 % \item Use option |color| if you have a color printer or if your
106 % printer at least can translate colors into greyscale-`colors'.
107 % \item Neither call any package that sets page layout parameters (like
108 % |\textheight|) \emph{after} |flabels| nor set them by yourself.
109 % \item If you are using colors: Create a file |color.cfg| including
110 % the line |\ExecuteOptions{<driver>}|, where |<driver>| stands for
111 % your color graphics driver, e.g.\ |dvips| or |xdvi| (see description
112 % of the |color| package).
113 % \item If you are using colors: Set the fore- and background colors for
114 % the ``company label'' and the whole label using |\setbgcompany|,
115 % |\setfgcompany|, |\setbglabel|, |\setfglabel|, each one of this
116 % accepts a color name as argument.
117 % \item Choose the text for the ``company label'' (the command for
118 % getting the default would be |\company{\huge LEITZ}|).
119 % \item In the document:
120 % \begin{itemize}
121 % \item If you want to create 4 ``empty'' labels for handwriting use
122 % command |\emptylabel{4}|
123 % \item If you want to print a label with text use the macro
124 % |\labeltext{text}|.
125 % \item Avoid empty lines (paragraphs) between the label because this
126 % may lead to a wrong vertical and horizontal placement of the
127 % labels.
128 % \end{itemize}
129 % \item Check for overfull |\hboxes| and (if necessary for the printer)
130 % shift the labels on the page up- or downwards using the macro
131 % |\extratopmargin<dim>|.
132 % \end{itemize}
133 %
134 %
135 % \subsection{Options}\label{sec:opt}
136 %
137 % The package recognizes the following options\DescribeMacro{Options}:
138 % |leitz|, |fullheight|, |narrow|, |color|, |a4paper|, |nice| and |nohole|.
139 %
140 % \begin{description}
141 % \item[\texttt{leitz}] This option is more-or-less a ``dummy option''
142 % since |leitz| is the default and, even more, the user has no other
143 % choice. Nevertheless it is an option because this should change in
144 % the future. To cut a long story short: You can ignore this option
145 % for now!
146 % \item[\texttt{fullheight}] See the pictures for the difference between
147 % |fullheight| and labels of normal height in
148 % sec.~\ref{sec:exam}. You may switch from large labels to the smaller
149 % ones (and vice versa) whenever you want from inside the document
150 % using the macros |\fullheight| and |\normalheight|.
151 % \item[\texttt{narrow}] Change the default width of the labels from
152 % 60mm to 37mm. You may also change the width from inside the document
153 % with the commands |\narrowlabels| and |\widelabels|.
154 % \item[\texttt{color}] Use this option if you have a color
155 % printer\footnote{You may also use colors if your printer can
156 % translate real colors into greyscale-`colors'!} to
157 % include the standard \LaTeXe\ package |color|. This package (see
158 % |color|-documentation |grfguide.tex|) needs to know the driver for
159 % which the color informations should be generated. So you have to create
160 % a file |color.cfg| including the line |\ExecuteOptions{<driver>}|,
161 % where |<driver>| stands for your color graphics driver, e.g.\
162 % |dvips| or |xdvi|. The colors to be used may be set in the preamble
163 % or in the document (see sec.\ \ref{sec:usercmd}).
164 % \item[\texttt{a4paper}] So far only ``Leitz-Ordner'' are supported by
165 % this package which are used for a4 paper. So normally you will
166 % include this option (or use the equivalent option for the
167 % document classes.
168 % \item[\texttt{nice}] This option should be used \emph{only} if you
169 % want to include labels in a normal document! Normally this package
170 % uses the whole page, changing nearly every layout parameter. Since
171 % this makes |flabels| very un-co-operative and forbids the use of
172 % this package inside a normal text document (unlikely that there is
173 % any need for this this but the documentation you read now uses the
174 % option |nice|). The option |nice| makes |flabels| nicer to other
175 % packages. Warning: If you use this option you have to take care
176 % for correct placement on the page for yourself!
177 % \item[\texttt{nohole}] Do not include a marker for the hole in the
178 % back of a ``Leitz-Ordner'' (to be used for an exact alignment of the
179 % label).
180 % \end{description}
181 %
182 % \subsection{User commands}\label{sec:usercmd}
183 % It follows a complete list of all user accessible macros, lengths and
184 % counters.
185 % \subsubsection{Label properties}
186 % Some of these macros have been described before in the options
187 % section.
188 % \begin{itemize}
189 % \item To switch to narrow labels use the macro
190 % |\narrowlabels|\DescribeMacro{\narrowlabels}.
191 % \item To switch to wide labels use the macro
192 % |\widelabels|\DescribeMacro{\widelabels}.
193 % \item To switch to large labels use the macro
194 % |\fullheight|\DescribeMacro{\fullheight}.
195 % \item To switch to small labels use the macro
196 % |\normalheight|\DescribeMacro{\normalheight}
197 % \item To change the text of the ``company label'' use the macro
198 % |\company{<name>}|\DescribeMacro{\company}
199 % \item\DescribeMacro{numberauxlines} Change the number of auxiliary
200 % lines in |\emptylabel| this way:\\
201 % |\setcounter{numberauxlines}{<number>}|
202 % (default is |4|). Usually you will also change the distance between
203 % the lines \dots
204 % \item \dots\ using the macro
205 % \DescribeMacro{\auxlinedistance}|\auxlinedistance<dim>| where
206 % |<dim>| can be any valid \TeX-dimension.
207 % \item You may also change the appearance of the ``company label'' via
208 % the redefinition of this three \emph{macros}:
209 % \DescribeMacro{\companylabelheight}|\companylabelheight|,
210 % \DescribeMacro{\ylowercompany}|\ylowercompany| and
211 % \DescribeMacro{\yuppercompany}|\yuppercompany|. Each of them are
212 % set to a \emph{number}, that is a lenght measured in the unit
213 % |mm|. You can get the default height of the company label e.g.\ by
214 % |\renewcommand{\companylabelheight}{17}|, since --by default-- this
215 % height is |17mmm|. The other two macros determine the \emph{y-coordinate
216 % of the bottom} of the upper and the lower label. Their default (for
217 % |leitz|) are |160| resp.\ |-68|.
218 % \end{itemize}
219 % \subsubsection{Changing colors}
220 % Set the fore- and background colors for the ``company label'' and the
221 % whole label using |\setbgcompany|\DescribeMacro{\setbgcompany},
222 % |\setfgcompany|\DescribeMacro{\setfgcompany},
223 % |\setbglabel|\DescribeMacro{\setbglabel} and
224 % \DescribeMacro{\setfglabel}|\setfglabel| (|fg| stands for `foreground'
225 % and |bg| for `background'), e.g.\ |\setbglabel{white}|.
226 %
227 % You have to use (predefined) color-\emph{names}, like
228 % |black| or |red|. Which names are already defined depends on you
229 % graphics driver. You may define \emph{new} colors following the
230 % |color|-package documentation |grfguide.tex|.
231 %
232 % \subsubsection{Layout parameters}
233 % As mentioned in the options section (see discussion of option |nice|,
234 % this package leaves only few layout parameters untouched to make the
235 % labels fit onto a page. Vertically there is no room for a user to
236 % adjust anything except the distance between the border of the paper
237 % and the labels. This is accessible via the macro
238 % |\extratopmargin<dim>|\DescribeMacro{\extratopmargin}. The
239 % default for this length is |0mm| -- then the large labels will be
240 % vertically centered on the page. With a positive |\extratopmargin| the
241 % labels will be shifted down (negative values are allowed).
242 %
243 % The horizontal layout is not that restricted, for example you can
244 % change the text width (as usual using the macro |\textwidth|) and all
245 % margins. The distance between two labels is generally handled by
246 % \TeX\ like any space between two words. (There must be space between
247 % the labels in order to give \TeX\ the chance to break ``lines'' of
248 % labels!) You may want to specify a \emph{minimum} distance (default
249 % is |0mm|) using
250 % |\setlength{\hspaceinterlabel}{<dim>}|\DescribeMacro{\hspaceinterlabel}.
251 %
252 % The distance between the text box of |\labeltext| and the label
253 % border is controlled by the length
254 % |\labeltextmargin|\DescribeMacro{\labeltextmargin}. It is preset to
255 % |3mm|. This value is at the same time top-, left- and right margin of
256 % the text (the lower boundary is free). It can be changed directly this
257 % way: |\setlength{\labeltextmargin}{<dim>}|.
258 %
259 % \subsubsection{Creating labels}
260 % To create labels you have the choice between 2 macros:
261 % \DescribeMacro{\emptylabel}|\emptylabel{<number>}| and
262 % \DescribeMacro{\labeltext}|\labeltext{<text>}|. Instead of a longish
263 % discussion look at the examples in sec.~\ref{sec:exam}. Note that the
264 % argument of |\labeltext| is typeset as plain text -- there is no predefined
265 % font change etc. The only special is the switch to the text color
266 % |\c@lorl@bel@fg| (if option |color| is chosen). If you want all your
267 % labels to be typeset in a special font perhaps with a title in a
268 % larger font size, you should define a macro, e.g.\ like this:
269 % \begin{verbatim}
270 % \newcommand{\mylabel}[2]{\labeltext{\vspace{1ex}\sffamily%
271 % \begin{flushleft}%
272 % \textbf{{\huge #1}}\\
273 % \textsl{\Large\flushleft{\large #2}}%
274 % \end{flushleft}}}
275 % \end{verbatim}
276 % To get a good positioning of the labels may take a while. The
277 % best advice I can give is: Avoid `paragraphs' between the labels,
278 % perhaps you have to remove also any `space' by ending the lines
279 % with a |%|. Then insert pagebreaks, |vspace| and |hspace| as
280 % needed. Having both large and small labels (|\fullheight| and
281 % |\normalheight|) on one page results in a wrong vertical placement
282 % of the smaller labels (the \emph{bottoms} of the labels instead of
283 % their reference points are vertically aligned)\footnote{The
284 % reason for that I currently do not unterstand, perhaps \emph{You} do?!}
285 %
286 % \subsection{Examples}\label{sec:exam}
287 % The following labels are drawn with a |\unitlength| of |0.5mm| instead
288 % of |1mm| (that is why they fit onto this page!). The \emph{vertical}
289 % label position on the paper (paper contour is drawn too) is the
290 % original one, while the \emph{horizontal} positioning shown here is
291 % very unusual (therefore you had to vary |\textwidth|, |\odd|- and
292 % |\evensidemargin|).
293 %
294 % \makeatletter
295 % \setlength{\unitlength}{0.5mm}
296 % \cnt@paperheight=297
297 % \cnt@pictvoffset=5
298 % \company{\large LEITZ}
299 % \begin{center}
300 % \begin{picture}(210,297)
301 % \iffalse ------ the paper contour ------ \fi
302 % \multiput(0,0)(210,0){2}{\line(0,1){297}}
303 % \multiput(0,0)(0,297){2}{\line(1,0){210}}
304 % \iffalse -- Update necessary due to new unitlength -- \fi
305 % \savebox{\theh@le}{%
306 % \begin{picture}(\hole@diameter,\hole@diameter)(17,17)
307 % \linethickness{0.01pt}
308 % \put(0,\hole@radius){\line(1,0){\hole@diameter}}
309 % \put(\hole@radius,0){\line(0,1){\hole@diameter}}
310 % \end{picture}%
311 % }
312 % \put(3,3){\framebox(100,61){\parbox{47mm}{
313 % \footnotesize \textbf{The vertical positioning} of the labels can be
314 % understood this way: The large labels are centered vertically on the
315 % page. The position of the small labels is fixed by the constraint
316 % that all labels should share the same reference point
317 % \texttt{(0,0)}. (That is why the ``company labels'' are all
318 % aligned.)
319 % }}}
320 % \iffalse ------------ 1. label -------------------- \fi
321 % \put(3,101){\emptylabel{1}}
322 % \put(3,66){\framebox(\l@belwidth,28){\parbox{27mm}{
323 % \footnotesize One empty label (\texttt{\bslash emptylabel\{1\}}),
324 % wide and small (this is the default)}}}
325 % \iffalse ------------ 2. label -------------------- \fi
326 % \company{\large\textsf{narrow}}
327 % \narrowlabels
328 % \put(66,101){\emptylabel{1}}
329 % \put(66,66){\framebox(\l@belwidth,28){\parbox{15.5mm}{
330 % \footnotesize One empty label, narrow and small}}}
331 % \iffalse ------------ 3. label -------------------- \fi
332 % \iffalse one text label (narrow, fullheight) \fi
333 % \company{\large\textsf{fullheight}}
334 % \fullheight
335 % \put(102,12){%
336 % \labeltext{\hspace{0.25\l@beltextwidth}\parbox{0.5\l@beltextwidth}{
337 % \sf\footnotesize
338 % \begin{flushleft}
339 % This narrow and large label has been generated with
340 % \texttt{\bslash labeltext} after commands \texttt{\bslash
341 % narrow\-labels} and \texttt{\bslash fullheight}
342 % \end{flushleft}
343 % }}}
344 % \iffalse ------------ 4. label -------------------- \fi
345 % \iffalse one text label (wide, fullheight) \fi
346 % \company{\large\textsf{wide}}
347 % \widelabels
348 % \put(142,12){%
349 % \labeltext{\hspace{0.25\l@beltextwidth}\parbox{0.5\l@beltextwidth}{
350 % \sf\footnotesize
351 % \begin{flushleft}
352 % This wide and large label has been generated with
353 % \texttt{\bslash labeltext} after commands \texttt{\bslash
354 % widelabels} and \texttt{\bslash fullheight}. The ``company
355 % name'' has been changed with \texttt{\bslash
356 % company\{\bslash huge \bslash textsf\{wide\}\}}.
357 % \end{flushleft}
358 % }}}
359 % \end{picture}
360 % \end{center}
361 % \makeatother
362 %
363 % \pagebreak[2]
364 % The next picture is not an example, but gives a listing of nearly all
365 % dimensions used by this package and a description of `empty' and
366 % text labels. Note that all variables containing an |@| are not
367 % directly accessible in the document (but some are via macros).
368 %
369 % \iffalse
370 % In the following pictures I had to change some lenghts and
371 % positions compared to the original values to get correct
372 % miniatures of the labels.
373 % \fi
374 % \makeatletter
375 % \setlength{\unitlength}{0.6mm}
376 % \cnt@paperheight=297
377 % \fullheight
378 % \widelabels
379 % \label{all_dimens}
380 % \begin{picture}(\l@belwidth,300)(-55,-105)
381 % \small
382 % \iffalse --------- First the label... --------\fi
383 % \savebox{\c@mpanyl@bel}{\thicklines
384 % \dashbox{2}(\l@belwidth,\companylabelheight){\c@mpany}}%
385 % \savebox{\theh@le}{%
386 % \begin{picture}(\hole@diameter,\hole@diameter)(17,14.5)
387 % \linethickness{0.01pt}
388 % \put(0,\hole@radius){\line(1,0){\hole@diameter}}
389 % \put(\hole@radius,0){\line(0,1){\hole@diameter}}
390 % \put(0,0){\dashbox{2}(\hole@diameter,\hole@diameter){}}
391 % \end{picture}%
392 % }
393 % \l@beloutline
394 % \multiput(-2,\cnt@auxlinedistance)(0,\cnt@auxlinedistance){%
395 % \value{numberauxlines}}{\line(1,0){\l@belwidth}}
396 % \iffalse --------- ... Now the description of it: -------\fi
397 % \multiput(-33,0)(10,0){13}{\line(1,0){5}}\put(95,2){%
398 % \makebox(0,0)[l]{\parbox{2.5cm}{\flushleft{lower part only for
399 % \texttt{fullheight}!}}}}
400 % \put(-10,-6.67){\vector(3,2){10}}
401 % \put(-10,-10){\makebox(0,0)[r]{(0,0)}}
402 % \put(70,-96.67){\vector(-3,2){10}}
403 % \put(70,-100){\makebox(0,0)[l]{
404 % (\texttt{\bslash l@belwidth},\texttt{\bslash l@belbase})}}
405 % \put(-10,-96.67){\vector(3,2){10}}
406 % \put(-10,-100){\makebox(0,0)[r]{
407 % (0,\texttt{\bslash l@belbase})}}
408 % \iffalse --------- company label: -------------------------\fi
409 % \put(-10,-74.67){\vector(3,2){10}}
410 % \put(-10,-78){%
411 % \makebox(0,0)[r]{(0,\texttt{\bslash ylowercompany})}}
412 % \put(-10,-59.5){\vector(1,0){16}}
413 % \put(-10,-59.5){%
414 % \makebox(0,0)[r]{Height \texttt{\bslash companylabelheight}}}
415 % \put(70,\ylowercompany){\vector(-3,2){15}}
416 % \put(72,-70){%
417 % \makebox(0,0)[l]{Box \texttt{\bslash c@mpanyl@bel}}}
418 % \put(70,180){\vector(-3,-1){27}}
419 % \put(70,181){%
420 % \makebox(0,0)[l]{\texttt{\bslash c@mpany}}}
421 % \put(70,156){\vector(-3,2){15}}
422 % \put(70,156){%
423 % \makebox(0,0)[l]{Box \texttt{\bslash c@mpanyl@bel}}}
424 % \put(-8,157){\vector(4,1){30}}
425 % \put(-11,157){%
426 % \makebox(0,0)[r]{Text color \texttt{\bslash c@lorc@mpany@fg}}}
427 % \put(-8,177){\vector(3,-1){17}}
428 % \put(-11,177){%
429 % \makebox(0,0)[r]{Bg. color \texttt{\bslash c@lorc@mpany@bg}}}
430 % \iffalse --------- the hole ---------------\fi
431 % \put(-8,-27){\vector(4,1){30}}
432 % \put(-12,-27){%
433 % \makebox(0,0)[r]{\parbox{2.5cm}{\flushleft{%
434 % Box \texttt{\bslash theh@le}:\\height = width =\\
435 % \hspace{1ex}\texttt{\bslash hole@diameter}}}}}
436 % \put(70,-39.7){\vector(-3,1){40}}
437 % \put(72,-42){%
438 % \makebox(0,0)[l]{(\texttt{\bslash halfl@belwidth},%
439 % \texttt{\bslash y@center@hole})}}
440 % \iffalse --------- aux. lines --------------\fi
441 % \put(30,10){\vector(0,-1){10}} \put(30,20){\vector(0,1){10}}
442 % \put(30,15){%
443 % \makebox(0,0){\texttt{\bslash cnt@auxlinedistance}}}
444 % \put(-5,30){\circle{5}}\put(-5,30){\makebox(0,0){\footnotesize 1}}
445 % \put(-5,60){\circle{5}}\put(-5,60){\makebox(0,0){\footnotesize 2}}
446 % \put(-5,90){\circle{5}}\put(-5,90){\makebox(0,0){\footnotesize 3}}
447 % \put(-5,120){\circle{5}}\put(-5,120){\makebox(0,0){\footnotesize 4}}
448 % \put(75,75){
449 % \makebox(0,0)[l]{\parbox{2.5cm}{\flushleft{The number of auxiliary
450 % lines is \texttt{numberauxlines}}}}}
451 % \iffalse --------- text box ----------------\fi
452 % \put(3,0){\dashbox{3}(54,157){}}
453 % \put(-22,62){\vector(3,1){25}}
454 % \put(-8,60){%
455 % \makebox(0,0)[r]{\parbox{3.5cm}{\flushleft{%
456 % The text box.\\-- distance to\\label outline is\\\texttt{
457 % \bslash labeltextmargin}}}}}
458 % \end{picture}
459 % \makeatother
460 %
461 % \subsection{To do}
462 % \begin{itemize}
463 % \item The package should support further binder formats!
464 % \item Perhaps the package should provide further special labels
465 % e.g.\ for a table of contents on the first page etc.
466 % \item Perhaps there should be an option for a landscape mode (using the
467 % |Lscape| package)?
468 % \item Perhaps the package should care for horizontal spacing and
469 % should help to avoid |Overfull \hbox| warnings.
470 % \item Perhaps even more lengths should be user-accessible (most of the
471 % macro names contain an |@| so you can not use them in a normal
472 % document).
473 % \item To be solved: Placing full- and normal-height labels on one
474 % page currently causes problems --- I have no idea why.
475 % \end{itemize}
476 % \textbf{If You} have any problems, suggestions, critical remarks -- or
477 % whatever according this package write to Volker B\"orchers
478 % (email-address see title).
479 %
480 % \StopEventually{}
481 %
482 % \section{The Macros}
483 %
484 % \begin{macrocode}
485 %<*package>
486 % \end{macrocode}
487 %
488 % \begin{macro}{Options}
489 % At the start of the package all Options are declared but
490 % for most options the implied actions are executed later (controlled
491 % by a corresponding |\newif|).
492 % \begin{macro}{leitz}
493 % As mentioned in section \ref{sec:opt} the option |leitz| is so far a
494 % ``dummy option'' since there is no alternative. If you want to add
495 % support for another label format you should make it choose-able as an
496 % option. The declarations below are only a part of the format-dependent
497 % settings (especially all widths are not set here). Some (not all!)
498 % other of these settings are in a |\ifl@itz| \dots\ |\fi|
499 % construction (see macros |\f@llheight| and |\n@rrow|).
500 % \begin{macrocode}
501 \newif\ifl@itz \l@itztrue
502 \DeclareOption{leitz}{\l@itztrue
503 \newcount\cnt@auxlinedistance \cnt@auxlinedistance=30
504 \newcounter{numberauxlines}\setcounter{numberauxlines}{4}
505 \def\hole@diameter{29}
506 \def\hole@radius{14.5}
507 \def\y@center@hole{-26.5}
508 \def\ylowercompany{-68}
509 \def\yuppercompany{160}
510 \def\companylabelheight{17}
511 \def\f@lll@belheight{285}}
512 % \end{macrocode}
513 % \end{macro}
514 % \begin{macro}{fullheight}
515 % If this option is chosen, the macro |\fullheight| (respectively
516 % |\f@llheight1|) is invoked later. The label will then extend
517 % (nearly) over the full height of the binder back (this is not the
518 % default).
519 % \begin{macrocode}
520 \newif\iff@llheight \f@llheightfalse
521 \DeclareOption{fullheight}{\f@llheighttrue}
522 % \end{macrocode}
523 % \end{macro}
524 % \begin{macro}{narrow}
525 % Invoke the macro |\narrowlabels| (resp. |\n@rrow1|) later to create
526 % narrower labels (default is wide labels).
527 % \begin{macrocode}
528 \newif\ifn@rrow \n@rrowfalse
529 \DeclareOption{narrow}{\n@rrowtrue}
530 % \end{macrocode}
531 % \end{macro}
532 % \begin{macro}{color}
533 % Load the package |color| later. This is not the default because
534 % not everyone has a color printer.
535 % \begin{macrocode}
536 \newif\ifcolorl@bel \colorl@belfalse
537 \DeclareOption{color}{\colorl@beltrue}
538 % \end{macrocode}
539 % \end{macro}
540 % \begin{macro}{a4paper}
541 % The same thing that the |\documentclass| option |a4paper|
542 % does. Perhaps this option should imply further actions?.
543 % \begin{macrocode}
544 \DeclareOption{a4paper}{\paperheight 297mm\paperwidth 210mm}
545 % \end{macrocode}
546 % \end{macro}
547 % \begin{macro}{nice}
548 % This option turns off the special, extreme, page layout of package
549 % |flabels|.
550 % \begin{macrocode}
551 \newif\ifbe@nice \be@nicefalse
552 \DeclareOption{nice}{\be@nicetrue}
553 % \end{macrocode}
554 % \end{macro}
555 % \begin{macro}{nohole}
556 % Do not include a marker for the hole in the back of a ``Leitz-Ordner''
557 % (to be used for an exact alignment of the label). A new option for a
558 % binder that do not have such a hole should include the command
559 % |\ExecuteOptions{nohole}|.
560 % \begin{macrocode}
561 \newif\ifno@hole \no@holefalse
562 \DeclareOption{nohole}{\no@holetrue}
563 % \end{macrocode}
564 % \end{macro}
565 % The end of the option section of the code: Produce an error message when
566 % unknown options (type mistakes\dots) are given; make |leitz| the default
567 % and force evaluation of the given option list.
568 % \begin{macrocode}
569 \DeclareOption*{\PackageWarning{flabels}{%
570 Unknown option `\CurrentOption' (Known option:\MessageBreak
571 `fullheight', `narrow', `color', `nohole', `a4paper', `nice')}}
572 \ExecuteOptions{leitz}
573 \ProcessOptions\relax
574 % \end{macrocode}
575 % \end{macro}
576 % \begin{macro}{\unitlength}
577 % \begin{macro}{\C@nvertToCount}
578 % \begin{macro}{\cnt@paperheight}
579 % The unitlength of the pictures used to
580 % create the labels is 1 millimeter. Since \TeX-dimensions are
581 % internally represented by integer variables (unit |sp|: scaled
582 % point) they are also `counters'. This macro converts |sp| into |mm|
583 % (code taken from |layout| package). |\cnt@paperheight| keeps the
584 % paper height in |mm| as a counter.
585 % \begin{macrocode}
586 \setlength{\unitlength}{1mm}
587 \def\C@nvertToCount#1#2{#1=#2 \divide #1 by 186468}
588 \newcount\cnt@paperheight
589 \C@nvertToCount\cnt@paperheight\paperheight
590 % \end{macrocode}
591 % \end{macro}
592 % \end{macro}
593 % \end{macro}
594 % \begin{macro}{\cnt@pictvoffset}
595 % \begin{macro}{\tmp@count}
596 % \begin{macro}{\tmp@count}
597 % The counter |\cnt@pictvoffset| (to be computed later) is used to place
598 % the label vertically centered on the page. |\tmp@count| and
599 % |\tmp@dim| are used as temporary variables.
600 % \begin{macrocode}
601 \newcount\cnt@pictvoffset
602 \newcount\tmp@count
603 \newdimen\tmp@dim
604 % \end{macrocode}
605 % \end{macro}
606 % \end{macro}
607 % \end{macro}
608 % \begin{macro}{pagelayout}
609 % Since the labels can be very large (compared to the paper height) we use
610 % the full page height if option |nice| is \emph{not} chosen. (This is
611 % not the same as the |fullpage| package does. Here we use really the
612 % whole page!) Horizontally this package leaves only a margin of |1in|
613 % on the left side but leaves |\textwidth| untouched.
614 %
615 % On the other hand this makes |flabels| very sensible to the sequence of
616 % |\usepackage| commands. If one loads a package after |flabels| that
617 % overwrites this settings again (like |a4|) the layout will be wrong.
618 % \begin{macrocode}
619 \ifbe@nice\relax
620 \else
621 \textheight\paperheight
622 \topmargin -1in
623 \oddsidemargin 0mm
624 \evensidemargin 0mm
625 \marginparwidth 0mm
626 \marginparsep 0mm
627 \headheight0mm
628 \headsep0mm
629 \fi
630 % \end{macrocode}
631 % \end{macro}
632 % \begin{macro}{\extr@topmargin}
633 % \begin{macro}{\extratopmargin}
634 % Definition of a dimension for extra vertical space at the top of a
635 % page and the macro |\extratopmargin| as an user interface to
636 % it. Note: A |\topmargin| of |-1in| means that the text/labels can
637 % start right at the top of the page. The way the macro is defined
638 % hides this offset of |-1in| from the user.
639 % \begin{macrocode}
640 \newdimen\extr@topmargin \extr@topmargin=0mm
641 \def\extratopmargin#1{\extr@topmargin=#1
642 \advance\extr@topmargin by -1in
643 \topmargin\extr@topmargin}
644 % \end{macrocode}
645 % \end{macro}
646 % \end{macro}
647 % \begin{macro}{\cnt@auxlinedistance}
648 % \begin{macro}{\auxlinedistance}
649 % The counter |\cnt@auxlinedistance| contains the distance between two
650 % auxiliary lines (for |\emptylabels|) in the unit |1mm|. It is preset
651 % by the option |leitz| to the value 30. To allow the user to use
652 % other dimensions than |mm| the macro |\auxlinedistance| is used.
653 % \begin{macrocode}
654 \def\auxlinedistance#1{\tmp@dim=#1
655 \C@nvertToCount\cnt@auxlinedistance\tmp@dim}
656 % \end{macrocode}
657 % \end{macro}
658 % \end{macro}
659 % \begin{macro}{\labeltextmargin}
660 % \begin{macro}{\l@beltextwidth}
661 % \begin{macro}{\hspaceinterlabel}
662 % |\l@beltextwidth| is the width of the text in the label text field
663 % -- it is a computed value (see macro |\labeltext|) since the
664 % label width is variable. The user can set |\labeltextmargin|, the
665 % margin between text and label outline (left and right side, top)
666 % instead to adjust the text width. |\hspaceinterlabel| (also
667 % user-accessible) is the \emph{minimal} horizontal space between two
668 % labels (it is more usually).
669 % \begin{macrocode}
670 \newdimen\labeltextmargin \labeltextmargin=3mm
671 \newdimen\l@beltextwidth
672 \newdimen\hspaceinterlabel \hspaceinterlabel=0mm
673 % \end{macrocode}
674 % \end{macro}
675 % \end{macro}
676 % \end{macro}
677 % \begin{macro}{\label@textheight}
678 % The text box extends from |y=0| to the ``company label''. We compute
679 % the text height in macro |\labeltext| as |\label@textheight| =
680 % |\yuppercompany| - |\labeltextmargin|.\\
681 % Note: making the box smaller moves the text down.
682 % \begin{macrocode}
683 \newcount\label@textheight
684 % \end{macrocode}
685 % \end{macro}
686 % Now the options |fullheight|, |narrow| and |color| have to be
687 % processed. (Till now only a corresponding |\newif| has been set.)
688 % \begin{macro}{->fullheight}
689 % \begin{macro}{\full@height}
690 % The first of this three options is |fullheight|. Of course we
691 % have to set here a big part of the label dimensions. Firstly we
692 % define a macro for internal use (the user interface for it is
693 % provided by the macros |\fullheight| and |\normalheight|). (For the
694 % explanation of |\l@belheight| and --|width| see
695 % figure on page \pageref{all_dimens}.)
696 % \begin{macrocode}
697 \def\full@height#1{%
698 \ifl@itz
699 \ifnum #1=0
700 \f@llheightfalse
701 \def\l@belheight{190}
702 \def\l@belbase{0}
703 \else
704 \f@llheighttrue
705 \def\l@belheight{\f@lll@belheight}
706 \def\l@belbase{-90}
707 \fi
708 \fi
709 % \end{macrocode}
710 % \begin{macro}{\cnt@pictvoffset}
711 % The small labels (|normalheight|) should have the same
712 % y-coordinate |y=0| as the big labels \emph{on the page}. We could
713 % achieve this by setting the y-offset (argument of the label picture
714 % environment!) to |\l@belbase|. Then the top of the big labels would
715 % start right the beginning of the paper.
716 %
717 % If we additionally want the big labels (|fullheight|) be
718 % vertically centered on the whole page we have to divide the
719 % remaining vertical space between top and bottom (this ends the macro
720 % |\full@height|):
721 % \begin{macrocode}
722 \cnt@pictvoffset=\cnt@paperheight
723 \advance\cnt@pictvoffset by -\f@lll@belheight
724 \divide\cnt@pictvoffset by 2
725 \advance\cnt@pictvoffset by \l@belbase
726 }
727 % \end{macrocode}
728 % \end{macro}
729 % \end{macro}
730 % After having defined |fullheight| and |normalheight| now we can
731 % call |\full@height| with the appropriate argument:
732 % \begin{macrocode}
733 \iff@llheight
734 \full@height1
735 \else
736 \full@height0
737 \fi
738 % \end{macrocode}
739 % \end{macro}
740 % \begin{macro}{->narrow}
741 % \begin{macro}{\n@rrow}
742 % Now option |narrow|! Here \emph{all horizontal} dimensions have to
743 % be set. As for |fullheight| we define a macro for internal use and
744 % call it then according to the chosen option.
745 % \begin{macrocode}
746 \def\n@rrow#1{%
747 \ifl@itz
748 \ifnum #1=0
749 \n@rrowfalse
750 \def\l@belwidth{60}
751 \def\halfl@belwidth{30}
752 \else
753 \n@rrowtrue
754 \def\l@belwidth{37}
755 \def\halfl@belwidth{18.5}
756 \fi
757 \fi
758 }
759 % \end{macrocode}
760 % \end{macro}
761 % Process option |narrow| now:
762 % \begin{macrocode}
763 \ifn@rrow
764 \n@rrow1
765 \else
766 \n@rrow0
767 \fi
768 % \end{macrocode}
769 % \end{macro}
770 % \begin{macro}{->color}
771 % The option |color| first loads the package |color|. ---
772 % \emph{Note:} The package |color| needs to know for which driver
773 % color informations have to be generated (|dvips|, |xdvi|,
774 % \dots). While we can not select the driver here (as an option:
775 % |\RequirePackage[<driver>]{color}|), we require the |color| macros
776 % \emph{now}. So the user must specify the driver in the file
777 % |color.cfg| with an |\ExecuteOptions{<driver>}| command.
778 %
779 % The colors of the labels will depend on 4 colors:
780 % \DescribeMacro{\c@lorc@mpany@bg} |\c@lorc@mpany@bg| (background of
781 % the ``company label''), \DescribeMacro{\c@lorc@mpany@fg}
782 % |\c@lorc@mpany@fg| (foreground of the ``company label''),
783 % \DescribeMacro{\c@lorl@bel@fg} |\c@lorl@bel@fg| (color of the
784 % labeltext), \DescribeMacro{\c@lorl@bel@bg} |\c@lorl@bel@bg| (back
785 % ground of the whole label). We define 4 macros as an user
786 % interface to these colors and use them to set the default colors.
787 % \begin{macrocode}
788 \ifcolorl@bel
789 \RequirePackage{color}
790 \def\setbgcompany#1{\def\c@lorc@mpany@bg{#1}}
791 \def\setfgcompany#1{\def\c@lorc@mpany@fg{#1}}
792 \def\setbglabel#1{\def\c@lorl@bel@bg{#1}}
793 \def\setfglabel#1{\def\c@lorl@bel@fg{#1}}
794 \ifl@itz
795 \setbgcompany{black}
796 \setfgcompany{green}
797 \setbglabel{yellow}
798 \setfglabel{black}
799 \fi
800 \fi
801 % \end{macrocode}
802 % \end{macro}
803 % \begin{macro}{\c@mpanyl@bel}
804 % Small labels have a ``company label'' at the top of the label and
805 % large labels in addition another near the bottom. It is a small box
806 % that may contain the logo of the company or institute or perhaps the
807 % user's name. We save it in the box |\c@mpanyl@bel|. The macro
808 % \DescribeMacro{\rem@kecompanyl@bel}|\rem@kecompanyl@bel| is used for
809 % each label by |\emptylabel| and |\labeltext|.
810 %
811 % The text in this box is kept in the macro |\c@mpany| and is
812 % user-accessible with the macro |\company| (defined below).
813 % \begin{macrocode}
814 \ifl@itz
815 \def\c@mpany{\huge LEITZ}
816 \fi
817 \newsavebox{\c@mpanyl@bel}
818 \def\rem@kecompanyl@bel{%
819 \ifcolorl@bel
820 \protect\savebox{\c@mpanyl@bel}{%
821 \fboxsep0pt\protect\colorbox{\c@lorc@mpany@bg}{%
822 \protect\makebox(\l@belwidth,\companylabelheight){%
823 \color{\c@lorc@mpany@fg}\c@mpany}}}%
824 \else
825 \thicklines\protect\savebox{\c@mpanyl@bel}{%
826 \protect\framebox(\l@belwidth,\companylabelheight){\c@mpany}}%
827 \fi
828 }
829 % \end{macrocode}
830 % \end{macro}
831 % \begin{macro}{\theh@le}
832 % This is specific to the label format. A ``Leitz-Ordner'' has a hole
833 % in the back of the binder to make the large binder handier (diameter
834 % 29mm). Since \TeX\ is not capable to typeset circles larger then
835 % 15mm, we mark this hole with a cross. The reference point of this
836 % box is its center.
837 % \begin{macrocode}
838 \newsavebox{\theh@le}
839 \savebox{\theh@le}{%
840 \ifl@itz
841 \begin{picture}(\hole@diameter,\hole@diameter)(\hole@radius,\hole@radius)
842 \linethickness{0.01pt}
843 \put(0,\hole@radius){\line(1,0){\hole@diameter}}
844 \put(\hole@radius,0){\line(0,1){\hole@diameter}}
845 \end{picture}%
846 \fi
847 }
848 % \end{macrocode}
849 % \end{macro}
850 % \begin{macro}{\l@beloutline}
851 % This macro draws the common label outline for text and empty
852 % labels. It has to be called from inside a picture environment.
853 % The background color of the label is realised by putting a box that
854 % is slightly larger than the label (2$\times$ 0.5mm more) on the
855 % appropriate place.
856 % \begin{macrocode}
857 \def\l@beloutline{
858 \fboxsep0.5mm
859 \ifcolorl@bel
860 \put(-1,\l@belbase){%
861 \colorbox{\c@lorl@bel@bg}{\makebox(\l@belwidth,\l@belheight){\relax}}}
862 \fi
863 \linethickness{0.01pt}
864 \multiput(0,\l@belbase)(\l@belwidth,0){2}{\line(0,1){\l@belheight}}
865 \multiput(0,\l@belbase)(0,\l@belheight){2}{\line(1,0){\l@belwidth}}
866 \thinlines
867 \put(0,\yuppercompany){\usebox{\c@mpanyl@bel}}
868 \iff@llheight
869 \ifno@hole\relax\else
870 \put(\halfl@belwidth,\y@center@hole){\usebox{\theh@le}}
871 \fi
872 \put(0,\ylowercompany){\usebox{\c@mpanyl@bel}}
873 \fi
874 }
875 % \end{macrocode}
876 % \end{macro}
877 % \begin{macro}{User commands}
878 % To switch between |fullheight|/|normalheight| and |narrow|/|wide|
879 % from inside the document we have these macros:
880 % \DescribeMacro{\narrowlabels} \DescribeMacro{\widelabels}
881 % \DescribeMacro{\fullheight} \DescribeMacro{\normalheight}
882 % \begin{macrocode}
883 \def\narrowlabels{\n@rrow1}
884 \def\widelabels{\n@rrow0}
885 \def\fullheight{\full@height1}
886 \def\normalheight{\full@height0}
887 % \end{macrocode}
888 % To redefine the company name:
889 % \begin{macrocode}
890 \def\company#1{\def\c@mpany{#1}}
891 % \end{macrocode}
892 % \end{macro}
893 % \hrule
894 % \begin{macro}{\emptylabel}
895 % The first macro that actually creates label is |\emptylabel|. It has
896 % as argument the number of identical labels to draw. Every `empty'
897 % label consists of the common label outline and a number
898 % (|numberauxlines|, user accessible) of auxiliary lines.
899 % \begin{macrocode}
900 \def\emptylabel#1{%
901 \rem@kecompanyl@bel
902 \tmp@count=#1\loop
903 \begin{picture}(\l@belwidth,\l@belheight)(0,\cnt@pictvoffset)
904 \l@beloutline
905 \multiput(0,\cnt@auxlinedistance)(0,\cnt@auxlinedistance){%
906 \value{numberauxlines}}{\line(1,0){\l@belwidth}}
907 \end{picture}
908 \hspace{\hspaceinterlabel}
909 \advance\tmp@count by -1
910 \ifnum\tmp@count>0\repeat
911 }
912 % \end{macrocode}
913 % \end{macro}
914 % \begin{macro}{\labeltext}
915 % Here the second macro for creating labels: |\labeltext|. Perhaps it
916 % would have been nicer to declare this as an environment but this
917 % should do. The text-width and -height is computed here.
918 %
919 % Note that the text is plain text -- there is no predefined font
920 % change etc. The only special is the switch to the text color
921 % |\c@lorl@bel@fg| (if option |color| is chosen).
922 % \begin{macrocode}
923 \def\labeltext#1{%
924 \rem@kecompanyl@bel
925 \l@beltextwidth=\l@belwidth mm
926 \advance\l@beltextwidth by -2\labeltextmargin
927 \C@nvertToCount{\label@textheight}{-\labeltextmargin}
928 \advance\label@textheight by \yuppercompany
929 \begin{picture}(\l@belwidth,\l@belheight)(0,\cnt@pictvoffset)
930 \l@beloutline
931 \put(0,0){\protect\makebox(\l@belwidth,\label@textheight)[t]{%
932 \parbox{\l@beltextwidth}{%
933 \ifcolorl@bel\textcolor{\c@lorl@bel@fg}{#1}\else #1\fi}}}
934 \end{picture}
935 \hspace{\hspaceinterlabel}%
936 }
937 % \end{macrocode}
938 % \end{macro}
939 % \begin{macrocode}
940 %</package>
941 % \end{macrocode}
942 %
943 % \Finale
944 \endinput