A package for making sticky labels in L^{A}TEX^{∗}

Sebastian Rahtz, Leonor Barroca  Grant Gustafson

1995/06/22

Contents

1 Usage 1 1.1 Paper Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Label Stock Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Customizing for Other Labels . . . . . . . . . . . . . . . . . . . . . 2 1.4 Using an External Label source File . . . . . . . . . . . . . . . . . 4 1.5 Labels in the Main File . . . . . . . . . . . . . . . . . . . . . . . . 5 1.6 Control Sequences to Make Labels . . . . . . . . . . . . . . . . . . 5 1.7 Wrapping Long Lines and Debugging . . . . . . . . . . . . . . . . . 6

Abstract

A L^{A}TEX style to print a regular grid of ragged-right labels on a page, suitable for sheets of labels which can be fed through a laser printer. Macros are provided to allow easy input of names and addresses in a form free of TEX markup. Equally useful is a feature for making multiple copies of a single label, e.g., return address stickers to go with the labels.

1 Usage

This style file was written to produce a sheet of labels which can be xeroxed onto Avery brand 5360 sticky-label material. This label material is made for a xerox machine and it has 7 rows and 3 columns of labels on letterpaper. It works for other label layouts as well. In particular, the defaults for the most popular paper sizes letterpaper and a4paper are 7 rows by 3 columns and 8 rows by 3 columns, respectively.

Other uses include production of disk labels, book labels, shipping labels, name tags, door cards, photo galleries and compact membership lists.

The service of this package is to produce a rectangular grid of items on a sheet of paper, with each item centered in its grid area. It really doesn’t matter what goes in the grid area: text, graphics or any L^{A}TEX construct. For example, you might use the fancybox package to produce oval-box or shadow-box name tags for a conference.

∗This file has version number 10, last revised 1995/06/22.

1.1 Paper Sizes

The paper size is supplied by the document options for the class. The European default is a4paper and the American default is letterpaper, 8.5 × 11-inch, inherited from the class file, e.g., article.cls.

a4paper 297mm by 210mm.

a5paper 210mm by 148mm.

b5paper 250mm by 176mm.

letterpaper 11in by 8.5in.

legalpaper 14in by 8.5in.

executivepaper 10.5in by 7.25in.

1.2 Label Stock Sizes

A number of different label stocks are available for xerox machines and laser printers. The typical stock has m rows and n columns with various gutters on the page. Below is a table of Avery products that are in common use in America.

Label Size Labels Rows Cols Gutters Avery
in inches per page  Stock No
1 \frac{7}{16} × 2 \frac{13}{16} 21/page  7  3  Yes  5360
2 × 4 \frac{1}{4}  10/page  5  2  Yes  5352
2 × 4  10/page  5  2  Yes  5327
1 × 4  20/page  10  2  Yes  5161, 5261
1 \frac{3}{8} × 2 \frac{11}{16} 21/page  7  3  Yes  5329
1 × 2 \frac{5}{8}  30/page  10  3  Yes  5331, 5160, 5260
1 \frac{1}{3} × 4  14/page  7  2  Yes  5162, 5262
\frac{1}{2} × 1 \frac{3}{4}  80/page  20  4  Yes  5267
1 × 2 \frac{3}{4}  33/page  11  3  No  5332, 5351, 5354, 5314

Another common label stock is Dennison 37-141, having 3 columns and 8 rows of 1\frac{3}{8} × 2\frac{7}{8} gutterless labels on letterpaper. The information by the manufacturer is not precisely correct, because the first column is exactly 2\frac{7}{8} inches wide, but the other two are 2\frac{13}{16} inches wide.

A common problem with implementing this package on a new label stock is precision of the laser printer, which prints the master, and the xerox machine which prints the master onto the label stock. Some of the above are for direct use on a laser printer, which removes one source of error, but replaces it by the possibility that the label stock will jam in the laser printer!

1.3 Customizing for Other Labels

Your labels will very likely be different than Avery 5360. So first you have to tailor your source file to a particular type of label. The lines below may be placed in the preamble and edited to suit the application and the actual printer used for output.

   \documentclass[12pt]{article}
   \usepackage{labels}

   \LabelCols=3%      Number of columns of labels per page
   \LabelRows=7%      Number of rows of labels per page
   \LeftBorder=8mm%   Space added to left border of each label
   \RightBorder=8mm%  Space added to right border of each label
   \TopBorder=9mm%    Space to leave at top of sheet
   \BottomBorder=2mm% Space to leave at bottom of sheet
   \begin{document}%  End of preamble

These controls can also be issued after the beginning of the document, but the results are undefined unless the following example is followed, which uses the \LabelSetup control sequence:

   \begin{document}%  End of preamble
   \LabelCols=3%      Number of columns of labels per page
   \LabelRows=7%      Number of rows of labels per page
   \LeftBorder=8mm%   Space added to left border of each label
   \RightBorder=8mm%  Space added to right border of each label
   \TopBorder=9mm%    Space to leave at top of sheet
   \BottomBorder=2mm% Space to leave at bottom of sheet
   \LabelSetup%       Invoke new settings

For example, your grid maybe has only two columns of ten labels each, requiring the first two variables to be reset. The gutter areas on the label material dictate how to set the other parameters, plus of course personal adjustments of the amount of white space around each label.

Your printer driver is expected to print the page exactly as it should in vanilla TEX, i.e., with the origin of the page down one inch and right one inch from the top left hand corner of the paper. If it doesn’t, adjust your driver parameters.

The usual problem with printers is that label output is quite wide, requiring the very edges of the paper, on which your printer may not write correctly. Ad-

just the parameters \LeftBorder, \RightBorder, \TopBorder, \BottomBorder

as outlined below to solve this common problem.

First of all, \TopBorder is not the white space at the top of the page, but the amount of space to leave at the top so that the first label is centered on its grid. This number is determined by trial and error using the actual printer, xerox machine and label stock to be used in the production run.

The second value \BottomBorder is determine empirically also, so that the labels are all centered on their grids. A mathematical formula to be satisfied is

        Label Height = \frac{paperheight − TopBorder − BottomBorder}{LabelRows}

The values \LeftBorder and \RightBorder are amounts of white space to be added to the left and right of the actual label area so that the label itself does not smash into the edge of the grid. The actual label width is considerably smaller than the grid width (physical width of the label stock). It is determined by the formula

         LeftBorder + Label Width + RightBorder = \frac{paperwidth}{LabelCols}

Normally, the left and right white space dimensions are the same, but there can be exceptions. It is best to determine the dimensions empirically on the actual equipment to be used in the production run. Visual guides from a dvi viewer can help, but be aware that the laser printer may fail to print near the edge and the xerox machine may either enlarge or shrink the image onto the label stock.

An option grid overlay can be produced with the label output for testing purposes by the preamble control sequence \LabelInfotrue. Most dvi viewers are capable of showing the entire test grid. Once printed, the overlay can be compared with the actual label stock to see if the borders are in the proper place. By adjusting parameters, the master copy off the laser printer should be able to go through the xerox machine automatically.

1.4 Using an External Label source File

The simplest form of input is very easy, as in the following example:

   \documentclass{article}
   \usepackage{labels}
   \begin{document}
   \labelfile{names.dat}
   \end{document}

where names.dat contains names and address in plain format. Source files in plain format may contain extra blank lines (only one blank between labels is required). Sort fields should begin with % in column 1, so they don’t print as part of the label. Leading and trailing blanks on lines are ignored. Ctrl-L’s seem to be acceptable in the source. They are not ignored, even if one appears at the end of the file. For example, if ^L appears on a line by itself, then it either produces an empty label or else a blank line, if it happens to be in a group of label lines. The label data commonly appears on lines, flush left, with no intervening blank lines, because a blank line signals a new label. To purposely create blank labels, as for filling out a page of labels, see the control sequence \skiplabels{#1}, infra. The actual text in the external file may contain L^{A}TEX markup controls. This includes comment marks %, which will be ignored during typesetting.

Source File Creation and Sorting

Most mailing lists that already exist can be edited to create an acceptable list in the proper format. If you want long lines to wrap, then force all the material to be wrapped onto one line in the source. Otherwise, break the material into lines of the length desired. Any special items in a mailing label can be coded in L^{A}TEX, e.g., foreign names with accented characters, trademarks and font size changes.

Generally, raw sources have to be searched for special L^{A}TEX controls and brought up to standard. The following characters are trouble in a raw source file. Only use for writing L^{A}TEX code obeying L^{A}TEX coding rules!

Double quote  \"     Hash (number) \#     Underscore    \_
Dollar        \$     Percent       \%     Ampersand     \&
Less than     \<     Greater than  \>     Vertical bar  \|
Commercial at \@     Backslash     \\     Circumflex    \^
Left brace    \{     Right brace   \}     Tilde         \~

A typical comment line might start with % and then ^L (ctrl-L) followed by a sort key (e.g., the zip code or last name). The emacs editor supports a method of sorting such records, thereby rearranging the source file into a new label order. The method:

• Mark the whole file as a region: ^[< goes to the top of file, then ^@ sets mark; follow by ^[> to mark the whole file.

• Invoke emacs’s sort-pages external routine as follows. Press ^[x then enter sort-pages and press return. The region marked will be sorted on the first line of each page, with a page delimited by ^L.

General purpose L^{A}TEX Source

If you want to set up a general-purpose L^{A}TEX source file, then use the following source, which prompts for the labels file name.

    \documentclass{article}
    \usepackage{labels}
    \begin{document}
    \promptlabels
    \end{document}

1.5 Labels in the Main File

You can, of course, just have the names and addresses in the main file, rather than using \labelfile to include them. The file format is to be exactly as described above, especially, follow the advice about blank lines, which delimit labels. This example makes use of the labels environment.

   \documentclass{article}
   \usepackage{labels}
   \begin{document}
   \begin{labels}
   Me
   My address
   My City, State, Zipcode
   My Brother
   His address
   His City, State, Zipcode
   \end{labels}
   \end{document}

1.6 Control Sequences to Make Labels

There are other ways of accessing the same system.

1. The control sequence called \addresslabel[#1]{#2} accepts for optional argument #1 L^{A}TEX controls, e.g., font size and style, and for argument #2 the rows of a tabular array of one column.

    \documentclass{article}
    \usepackage{labels}
    \begin{document}
      \addresslabel[\small\sf]
      {Me \\my street \\ mytown \\ England}
    \end{document}

2. Boxed labels use the special macro called \boxedaddresslabel[#1]{#2}, as follows. This produces a frame-box around the label itself, leaving lots of white space around the frame. An optional argument [#1] is provided for local setting of L^{A}TEX controls, for example, [\fboxsep=3pt] will change the white space near the frame. The boolean variable \LabelInfotrue appears in the preamble in order to print out additional information, especially the label dimensions and the settings of certain variables.

    \documentclass{article}
    \usepackage{labels}
    \LabelInfotrue
    \begin{document}
      \boxedaddresslabel[\fboxsep=3pt]
      {{\bf Me} \\my street \\ mytown \\ England}
    \end{document}

3. To duplicate a label, there is a counter called \numberoflabels which you can set. For example, to print a return address 21 times, use this source:

    \documentclass{article}
    \usepackage{labels}
    \numberoflabels=21
    \begin{document}
      \addresslabel{Me \\my street \\ mytown \\ England}
    \end{document}

4. For more sophisticated users, there is a macro \genericlabel which you can call, with an argument of whatever you want to appear on the label (e.g., for disk labels). Thus you could have

     \genericlabel{%
     \begin{tabular}{|c|}
     \hline
     My Amazing Program\\
     \hline
     Disk 1 of 1\\
     \hline
     \em We aim to serve\\
      \hline
     \end{tabular}
     }

to produce a label like this:

                                                |------------------|
                                                |My Amazing Program|
                                                |------------------|
                                                |Disk 1 of 1       |
                                                |------------------|
                                                |We aim to serve   |
                                                |------------------|

This feature has been used to print business cards with graphical logo.

1.7 Wrapping Long Lines and Debugging

Debugging of label files can be assisted by the internal error messages which are emitted when a label box is too high or too wide for the set parameters. This kind of error is unlikely to occur with the standard controls and the labels environment, because by default they use ragged right and wrap long lines.

In all modes, you can opt for a grid around each label field by setting a Boolean variable called \LabelGridtrue, e.g.,

    \documentclass{article}
    \usepackage{labels}
    \LabelGridtrue
    \numberoflabels=21
    \begin{document}
      \addresslabel{Me \\my street \\ mytown \\ England}
    \end{document}

By default you get no grids. The grids are useful for judging the ‘spillover’ of addresses onto adjacent labels, caused by long lines. See also \boxedaddresslabel, which draws a tighter box with more white space around the label text. Both can be used at the same time.