Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to create a LaTex document that will allow me to write the text of the birthday invitations once with the formatting I desire, and then have Latex automatically fill in the recipient's names from a list on each different one (as well as have multiple invitations per letter sized sheet of paper).

I have searched this sight as well as the Latex wikibook and a Latex website for templates (to see if anyone has done something similar) or similar concepts. I haven't found anything that would help me do this.

share|improve this question
1  
A solution does not have to rely on lists. For example, creating a macro \invite{<name>} would permit to create the desired invitations by using one \invite call per guest without an explicit list. –  Christian Lindig Jun 26 '12 at 12:17
add comment

3 Answers 3

I would suggest using a two-step approach:

  1. Create a standard document layout that has the outline for the invitation set according to your requirements.
  2. Use pdftk or pdfpages (or something similar) to print the output in 2-up, 4-up, or whatever.

Regarding 1, here's a template:

enter image description here

\documentclass{article}
\usepackage[paperwidth=4in,paperheight=5.5in,margin=.5in]{geometry}% http://ctan.org/pkg/geometry
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\pagestyle{empty}% No page headers/footers
\setlength{\parindent}{0pt}% No paragraph indent
\newcommand{\createinvite}[1]{%
  \renewcommand{\do}[1]{%
    \clearpage
    Dear ##1,\par\medskip
    \lipsum[1]\bigskip
    See you there,\par\medskip
    \textit{Random Randolfsky}
  }%
  \docsvlist{#1}%
}
\begin{document}
\createinvite{Tom,Dick,Harry,Susan}
\end{document}

geometry sets the document layout and size, while lipsum provided some dummy text. etoolbox provides the list-processing capability via \docsvlist{<list of names>}. The main function is \do which processes each element of the comma separated list. I've renewed it to print some salutation, followed by the invitation, followed by the signature.

Since \clearpage only clears the page if it is non-empty, there is no concern issuing it at the start of \do.

share|improve this answer
20  
oh, please use ragged right! this is a party, not a solemn symposium. –  barbara beeton Jun 22 '12 at 22:14
1  
I have tried your solution. Thank you for the suggestion. The example was very helpful. I had trouble getting lipsum to work, but since I didn't need that to test the automatic names I went ahead and replaced it with actual text. It does automatically put names into the invites from a comma seperated list like I was wanting. =) Thank you! –  Marie Mikels Jun 24 '12 at 23:33
    
@MarieMikels: Exactly. lipsum is merely used to populate a document with dummy text and is not needed for the "end product". Consider using @_barbarabeeton's suggestion of \raggedright, just for fun. Also, if this answer helped you most, consider accepting it as such. See How do you accept an answer? –  Werner Jun 25 '12 at 0:38
1  
Instead of \raggedright you should use the ragged2e package and \RaggedRight. Standard \raggedright looks awful. –  Christian Jun 25 '12 at 6:20
add comment

Here is a solution using a csv data file with the names, then using the datatool package to create the invitations, finally using Werner's recommandation to use a pdf printer to get 4up. I used PDF995 (which was on my laptop).

First create the csv file. I just used notepad to create the file and then did a save as to marie-names.txt

I now have the following file in csv format

FirstName
Bob the Tomatoe
Larry the Cucumber
Big Bird
Waldo (if found) 

Now I modified the instructions found at http://latex-my.blogspot.com/2012/01/mail-merge-batch-generating-documents.html to get the following MWE. Note: old-border.jpg is from http://www.fromoldbooks.org/Aubrey-HistoryOfEngland-Vol2/pages/438-Border-of-twigs/ and picture1.png was converted using powerpoint from http://aknockoutphoto.wordpress.com.

% Use scrartcl to allow larger base font size
\documentclass[16pt]{scrartcl}
\usepackage[left=3cm,right=3cm,top=6cm,bottom=5cm]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{wallpaper} % For background image frame

\usepackage{datatool}
% Load database 'names' from file 'marie-names.txt''
\DTLloaddb{firstnames}{marie-names.txt}%Import the txt file in csv format as a database
\begin{document}
\linespread{2}\selectfont %Changing linespacing for the font and enabling the change
\pagestyle{empty}% Turn of page numbers
% Set old-border.jpg as background image
\TileWallPaper{\paperwidth}{\paperheight}{old-border}%Loading a borderpattern
% Ref: http://www.fromoldbooks.org/Aubrey-HistoryOfEngland-Vol2/pages/438-Border-of-twigs/

% For each record (line) in database 'names'
% Assign field values by name to macros
\DTLforeach{firstnames}{\name=FirstName}{
  {\centering
    {\LARGE\bfseries Birthday Party Invitation}\par
   \smallskip\large Dear \name,\par\smallskip
   You are invited to a cookout to celebrate Cookie Monster's 44th birthday!\par
    \medskip
    Saturday, November 10, 2012 from 5:30 -- 9:00 p.m.\par 
    \medskip
    1234 Sesame Street\par 
    Anywhere, USA\par 
    \medskip
  Please RSVP to Miss Piggy at 987-654-abcd\par \bigskip
 \includegraphics{picture1.png}\par
    \pagebreak}
  }

\end{document}

Now compile with pdflatex and view. Now print with a package capable of creating a 4up pdf page and your get

enter image description here

share|improve this answer
add comment

Create a txt file consisting of rows of the following form:

\ADR{Paul}{Dirac}{m}{Highstreet}{7}{Edinburgh} 

You can use up to 9 fields (because commands can't have more parameters in LaTeX). All entries must have the same number of fields.
Save this file e.g. as adr.txt
Then write your letter with latex and use:

\documentclass{letter}
\begin{document}
\newcommand{\ADR}[6]{%
   \begin{letter}{#1 #2 \\#4\\#5}
   \opening{Dear #1,} 
   We would like to invite you ...
   \closing{Regards}
   \end{letter}
   }
\input{adr.txt}
\end{document}

All you have to do is to replace names, given names, street etc. with the field number of your \ADR definition. This should work on all letter classes.

share|improve this answer
    
I just edited the code to make a MWE. Very nice idea. –  R. Schumacher Jun 25 '12 at 14:33
    
@R.Schumacher I use the way of may edited answer. Each begin{letter} starts a new page, though no \clearpage is needed. –  Peter Breitfeld Jun 26 '12 at 11:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.