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