Sunday, May 4, 2008

Printing address labels using LaTeX

One of the best things about CTAN is that it has all the software for your everyday needs. For the last couple of weeks, I'd been sending out some large number of snail mails to a lot of organisations. And my handwriting is pretty much crap; even I can't decipher it after a few days. The return address looked like I had an epileptic seizure when writing it. And the solution was to print out my return address on labels. I could spent half an hour, doing it on my own (which would have been crappy too) but why reinvent the wheel? I was pretty confident that it had been done before.

Since I had MikTeX installed, I fired up the package manager and soon enough, located the labels package. Installing through the package manager was a breeze. And the documentation is excellent. Here's what you need to type to print a A4 sheet of your own address labels.

\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\LabelCols=3 %3 columns of labels
\LabelRows=7 % 7 rows of labels
\numberoflabels=21 % number of repeated labels

\begin{document}
\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ Sivaram} \\Line1\\Line2 \\Bangalore \\Karnataka}

\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ John Doe} \\Line1\\Line2,\\ Bangalore \\Karnataka}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Save and run PDFLaTeX on the file and you should get a 2 page PDF that has 21 address labels on each.

Locate a paper cutter and chop the paper and you have your address labels ready. That's it. It took me half an hour to do this. Which is the same time to do it on my own, :-) but at least this is definitely much better than the trial and error method of trying out fonts with different sizes and boldness.