I would like to make stickers for envelopes. Each sticker would contain data about one recipient of the letter. I would like to be able to have this data in some text format (CSV) and that LaTeX would take it and format it for printing, of multiple stickers on one page. Is there a package for something like this? Is there some other efficient way to do it?
[Tex/LaTex] A package to make stickers
packages
Related Solutions
You can build your TeX database, based on your needs simply by creating a list to hold the list of persons you sending your mailing. We will create a list with fields as shown in the table below, will also keep it sorted to make life easier.
This is done by creating first an empty list \let\alist\@empty
The format of the input file, is best to be in TeX format, to make the programming easier and to enable the use of a comma in the addresses. I have used the following format for capturing the fields, but please feel free to use your own:
\RB Nisbet|John|Mr.| 235, Highlands, Scotland | United Kingdom;
\RB Guevara|Che|Dr.| 527 Main Street, Havana | Cuba;
\RB Zapata|Emiliano|Mr.| 5237, Mexico City | Mexico;
\RB von Kleist-Schmenzin|Herr| Ewald| Greens, Dubberow| Germany;
Names are delimited by "|" and an ending semicolon. The standard part of the letter is on a separate file called stdletter.dat
. I have generated it on the fly using the filecontents
package. The MWE example is shown below.
\documentclass{article}
\usepackage{lstdoc,booktabs,filecontents}
\begin{filecontents}{stdletter.dat}
We are happy to enclose our new catalogue.
\vspace{20pt}
Regards,
\vspace{20pt}
Some CEO
\end{filecontents}
\begin{document}
\pagestyle{plain}
\makeatletter
\let\alist\@empty
\let\blist\@empty
\def\addtolist#1#2{%
\lst@lAddTo#1{#2}
}
\def\addtolist#1#2{%
\lst@lAddTo#1{#2}
}
\def\RB#1|#2|#3|#4|#5;{%
\addtolist{\alist}{#1#2,}%
% macro for table
\expandafter\gdef\csname#1#2@table\endcsname{\textit{#1}\cr\relax}
% macro for salutation
\expandafter\gdef\csname#1#2@salut\endcsname{Dear #3 #2\relax}
\lst@BubbleSort{\alist}
}
%% adding the data now
\RB Nisbet|John|Mr.| 235, Highlands, Scotland | United Kingdom;
\RB Guevara|Che|Dr.| 527 Main Street, Havana | Cuba;
\RB Zapata|Emiliano|Mr.| 5237, Mexico City | Mexico;
\RB von Kleist-Schmenzin|Herr| Ewald| Greens, Dubberow| Germany;
%% typesetting the table
\def\addresslist{%
\newsavebox{\tempbox}
\savebox{\tempbox}{
\centering
\begin{tabular}{llll}
\toprule[1pt]
First Name & Second Name & Salutation & Address\\
\midrule
\@for\i:=\alist \do{\csname\i @table\endcsname}
\vspace{-14pt}\\\bottomrule
\end{tabular}}
\begin{table}
\usebox{\tempbox}
\caption{Client List}
\end{table}
}
\addresslist
\mbox{}\newpage
\@for\i:=\alist \do{\csname\i\endcsname
\csname\i \endcsname
\expandafter\csname \i @salut\endcsname
\par\medskip
\input{stdletter.dat}
\pagebreak
}
\makeatletter
\end{document}
The "article" part can be created the same way or preferably printed separately and resetting page numbering (much easier).
I've always been a big advocate of setting a letter using the default article
document class, since it allows you the freedom you want in a natural way. There's no need to adjust the setting of the letter
class to suit your needs rather than just writing it using another (more flexible) class.
\documentclass{article}
\usepackage{newcent} % Default font is the New Century Schoolbook PostScript font
\usepackage{lipsum}% Just for this example
\usepackage[margin=1in]{geometry}%
\setlength{\parindent}{0pt}% No paragraph indent
\setlength{\parskip}{.3\baselineskip}
\begin{document}
%----------------------------------------------------------------------------------------
% YOUR NAME & ADDRESS SECTION
%----------------------------------------------------------------------------------------
\begingroup
\large\bfseries David Harris \par % Your name
\vspace{\dimexpr-\parskip+20pt}
\rule{\linewidth}{1pt}\par
\vspace{\dimexpr-\parskip+20pt}
\null\hfill
\begin{tabular}{r@{}}
Springfield 500 \\ Los Angeles, California 99999 \\ 111-111-1111 % Your address and phone number
\end{tabular}
\endgroup
\vspace{2\baselineskip}
\today
\vspace{2\baselineskip}
%----------------------------------------------------------------------------------------
% ADDRESSEE SECTION
%----------------------------------------------------------------------------------------
\begin{tabular}{@{}l}
Jesse O'Dell and Eilene Powell \\
TOP Coordinators \\
Office of Instructional Development \\
70 Powell Library, Box 951515 \\
Los Angeles, CA 90095-1515
\end{tabular}
\vspace{2\baselineskip}
%----------------------------------------------------------------------------------------
% LETTER CONTENT SECTION
%----------------------------------------------------------------------------------------
Dear Coordinators Jesse O'Dell and Eilene Powell:
\vspace{\baselineskip}
\lipsum[1-5]
\vspace{\baselineskip}
Sincerely yours,
\vspace{4\baselineskip}
David Harris% Your name for the signature at the bottom
\end{document}
All the \vspace
s can be modified to suit your needs.
Best Answer
The envlab package is perhaps the best choice for labels themselves. In combination with datatool this can be very powerful. I've written a demo on this for the UK-TUG pages: summarising here, the LaTeX file is
with a database such as
The code I've added on top of the basics here is used to 'pretty print' addresses: you might not need all of it.