Label & Card printing resources with TeX and LaTeX

Fans of OpenOffice, Abiword, and KOffice, and Scribus dominate the open source document printing discussion, because traditional office suites and desktop publishing apps account for the lion’s share of the pages in our paper trays. But for a lot of old-school typesetters and writers, nothing in the WYSIWYG realm can hold a candle to the performance and flexibility of TeX, and its popular LaTeX and BibTeX derivatives. Although TeX is most often used to create structured documents like research papers, it can be used to generate any document type — including specialty items. For the unfamiliar, here are some resources for using TeX to print envelopes, labels, badges, and cards.

A bit of background

TeX, for those who have not used it, is a text-markup language. The markup syntax is different, but much like HTML, it uses special tags to designate emphasis, boldface, spacing adjustments, bulleted lists, footnotes, and all other sorts of typographic elements. But TeX is designed for printing, not on-screen display. It was created by computer science guru Donald Knuth to help him typeset The Art of Computer Programming, and it handles complex print-centric tasks like hyphenation, justification, and footnotes/end-notes with ease. It also has robust support for typesetting mathematical expressions, which makes it the de-facto choice of a variety of scientific journals.

In practice, the chief difference between a word-processing program and authoring the same document in TeX is that TeX requires you to mark up document elements semantically, rather than directly changing the formatting. For example, when mentioning a book or article by title in a word processor, you highlight the title then click on the italicize button in the menu. In TeX, you would mark up the title with the \emph{} tag, which functions much like HTML’s <em></em> tags.

But TeX gets far more advanced by combining multiple features. To create footnote citations in a word processor, you might highlight the title of the work, then type in a footnote number parenthetically after it (perhaps even creating a superscript), keeping track of the numbers used, and enter the bibliographic data at the bottom of the page . In TeX, you enter all of the bibliographic entries you need once, then in the text, simply reference them in-line, like \cite{McGuffin}. When sent to output, TeX automatically keeps track of the footnote numbers for you, and pulls in the “McGuffin” entry from your bibliography. If you add, remove, or rearrange references, TeX fixes up all of the revisions with no intervention on your part.

In practice, most TeX users create their documents with the LaTeX and BibTeX add-on systems. These are sets of commonly-used macros and reusable document definitions that provide a high-level interface to raw TeX. But the nitty-gritty details of TeX itself are always accessible as well.

The TeX and LaTeX community is free-software-driven, and many users share their own macros, templates, and packages for implementing useful printing techniques. Printing for labels, envelopes, and cards is no exception. There are several packages that solve particular printing problems, plus a few that offer more general-purpose facilities.

TeX and LaTeX packages for specific label and card types

Perhaps because TeX enables the user to use fine-grained manipulation, a lot of TeX enthusiasts have used it to create precise packages for specific print jobs.

For example, Piet van Oostrum’s badge package is designed to typeset and print conference ID badges. The package pulls attendee names and employers from a file, then generates a set of output files fitting as many badges onto a badge as possible, complete with logos and conference information common to each badge. The default badge size is 7.5-by-4 centimeters (approximately business-card-sized), although you can change this setting.

The flabels package is built for printing labels for 3-ring binders. It is written for “Leitz-Ordner” binders, which are A4-sized; however, the macro source code is thoroughly documented, so adjusting the measurements for different sized binders is straightforward.

There are not one but three packages for creating cassette tape labels, which perhaps reveals as much about LaTeX long history as it does the tricky problem of fitting labels onto the varying space provided on cassettes. Morgan Besson’s casslbl is designed for audio cassettes, rendering two-sided track-listings for cassette “J cards.” So too does Alexey Shipunov’s cassette-shipunov, which includes instructions in Russian as well as English. Martin Nickel’s megatape offers a bit more, such as printing multiple tape labels per sheet, and a global numbering scheme for people working with collections.

More useful today are the packages that target standard label layouts. R. Bharat Rao’s labelmac3 targets the Avery® 5160 label sheet, which is frequently used for postal address labels. Label-pln produces 1.56-by-2.75-inch labels, which are a bit larger than 5160. The address package is built for an unspecified three-across page layout, but it also features several utility routines that make it more useful, such as the ability to pull addresses from an external file, and do a “mail merge”-type form letter generation.

Worldlabel WL-875 (same size as Avery® 5160)

There is also basic support for mailing address labels built-in to LaTeX’s “Standard Letter” document class. This class defines a “letter” environment that contains (among other things) the mailing address. Using the \makelabels command in your document will print out a sheet of Avery® 5352-formatted labels using the value of the address defined by the document. There is more detail in the official documentation (PDF).

Configurable, multi-format packages

The LaTeX package named simply “labels,” maintained by Julian Gilbey, was initially designed to support only Avery® 5360 label templates, but now covers many more. The documentation explains how to alter the package variables for number of columns and rows, left, right, top, and bottom border width, and even provides sample values for a dozen common Avery and Dennison label stock layouts.

Thomas Emmel’s ticket package provides a general interface for defining your own smaller-than-a-page printed items, whether they are labels, business cards, badges, or event tickets. You simply write a “ticket definition” file specifying the size, horizontal and vertical offsets, and row and column count, then create a document containing \ticket specifications for your data. There are options for adding registration marks or cut-marks to the final output, which is a nice touch.

Both of these packages require a significant amount of work, either in defining the layout of the label or card, or in manually assembling the data.

Boris Veytsman’s EnvLab package, on the other hand, is a full-featured LaTeX package that supports multiple label types and envelope sizes. It works by modifying the \makelabels command found in the Standard Letter document class, extending it to support several additional options, such as Avery® label templates (avery5160label, avery5262label, et cetera) and standard envelope sizes (“business,” “personal,” “booklet,” et cetera).

The package makes a distinction between “normal” labels and “big labels” (in particular the 5163 and 5164 label sizes), because the “big labels” are generally used to print both the sending and return address on a single label, and consequently require different data layout parameters. EnvLab supports starting a label-printing job in the middle of a partially-used label sheet, can print postal barcodes beneath addresses, and even supports passing printer-specific commands through the document to the output, such as waiting for envelopes to be fed through the manual paper slot, rather than the normal paper tray.

There are also customization options to handle printing logos onto labels and envelopes, rotating the orientation of the printout, several other tweaks. Perhaps the nicest thing about EnvLab, though, is that it builds on top of LaTeX’s existing Letter class, so you can easily integrate it into your printing workflow with the documents you already create.

Starting points for the new TeX aficionado

Although TeX itself has a very clean and easy-to-read syntax, if you are a complete TeX newbie you may still face a learning curve because of the different approach you take to creating a document and generating final output for it. There is a different toolchain, and you must adjust to creating your document using semantic rules that do not directly tell you what the printed output will look like.

One excellent place to get started is at Wikibooks, which has a robust e-book guide to LaTeX, covering everything from the basics of markup, to using document types, to advanced formatting, bibliographies, and embedded images. LaTeX is generally easier for newcomers to pick up on because it presents an easy-to-use layer of common operations on top of raw TeX. You can always move on to a TeX guide once you have the basics of LaTeX down pat. The TeX Users Group maintains a detailed list of helpful resources for those learning TeX and LaTeX, as well as publishing a newsletter and other content itself. The really hardcore will, of course, want to read Knuth’s TeXbook and Leslie Lamport’s LaTeX: A Document Preparation System, the official guides to each project.

BY NATHAN WILLIS

Other resources:

ajackson/software/maillabels/

Glabels

Openoffice.org Labels Templates

Printing Avery Labels in Linux

Label Nation

*World Label does not sell Avery-branded labels. “Avery Dennison®”, “Avery®” and all other Avery-branded product names and SKU trademarks are trademarks of Avery Dennison Corporation. Avery Dennison does not sponsor or endorse any products made or sold by World Label.

One thought on “Label & Card printing resources with TeX and LaTeX

  1. Terry Burton

    In relation to this and your recent article [1] about my Barcode Writer in Pure PostScript, readers my also be interested to learn about the pst-barcode LaTeX package [2] that permits the trivial inclusion of BWIPP barcodes within LaTeX documents as demonstrated by the following PDF: http://mirror.ox.ac.uk/sites/ctan.org/graphics/pstricks/contrib/pst-barcode/pst-barcode-doc.pdf

    [1] http://goo.gl/3uMHM
    [2] http://www.ctan.org/tex-archive/graphics/pstricks/contrib/pst-barcode/

    All the best,

    Terry

Leave a Reply

Your email address will not be published. Required fields are marked *