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.
General ⇒ Sending a letter to many addresses
Sending a letter to many addresses
Last edited by Eamon on Wed Jan 13, 2010 4:31 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 90
- Joined: Fri Nov 06, 2009 7:29 am
Sending a letter to many addresses
Yes it is possible - see section 2.1 of this document
Sending a letter to many addresses
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):
Instead of the book document class you could use a more appropriate class (scrlttr2 from the KOMA-Script bundle, for example).
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Sending a letter to many addresses
The UK TeX Users' Group website has a demo file for exactly this: see http://uk.tug.org/training/templates/
Joseph Wright
Re: Sending a letter to many addresses
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!
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!