GeneralSending a letter to many addresses

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Eamon
Posts: 2
Joined: Wed Jan 13, 2010 12:14 am

Sending a letter to many addresses

Post by Eamon »

Hi everyone,

Just wondering if this is possible:

What I'm trying to do: send a letter to about 30 different places. Each letter would be identical except the address.

My question: is it possible to get latex to produce many different, almost identical documents , simply and easily?

At the minute the only way I know how to do this is write the letter, compile document, rename output document, change address in document, recompile document, ...x30 times. I'm hoping there is an easier way.

I apologise if this is trivial and really obvious how to do, but any help would be much appreciated.
Last edited by Eamon on Wed Jan 13, 2010 4:31 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

Sending a letter to many addresses

Post by magicmoose »

Yes it is possible - see section 2.1 of this document
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Sending a letter to many addresses

Post by gmedina »

Hi,

the first idea that came to my mind was to use an array (created with the help of the arrayjob package) to store the different addresses and then to perform a loop (with the help of the \whiledo command from the ifthen package) to produce the letters. The following simple code illustrates this idea for an array with three entries( sorry, but I initially misread your question and understood "different names"; of course, you can adapt my example according to your needs):

Code: Select all

\documentclass{article}
\usepackage{arrayjob}
\usepackage{ifthen}

% creation of the counter used for the array of names and for the \whiledo loop
\newcounter{mycounter}

\begin{document}

% definition of the new array
\newarray\Names
% filling the array
\readarray{Names}{Jack Nicholson&Harrison Ford&Clark Gable}

% loop to produce the documents
\whiledo{\value{mycounter} < 3}
{
\stepcounter{mycounter}
Dear Mr.\Names(\value{mycounter})

The letter contents goes here...

\clearpage
}

\end{document}
Instead of the book document class you could use a more appropriate class (scrlttr2 from the KOMA-Script bundle, for example).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: Sending a letter to many addresses

Post by josephwright »

The UK TeX Users' Group website has a demo file for exactly this: see http://uk.tug.org/training/templates/
Joseph Wright
Eamon
Posts: 2
Joined: Wed Jan 13, 2010 12:14 am

Re: Sending a letter to many addresses

Post by Eamon »

Thanks for all the help.

In the end I used the method described in the document posted by magicmoose and it worked great, but thanks to the others for their help too!
Post Reply