I'm trying to generate cover letters starting from a single document. Since I'm sending the same letter to different persons with different address I thought it would be great to use this document as template and change only the information pulling data from another file, much in the way dynamic HTML documents works.
Now I have two documents, the main one that will contain all the letters and pull the information, and the other with the content. Here are my documents:
This document is called "Infection-Label_letters:"
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\usepackage{datetime}
\usepackage[ngerman,english]{babel}
\usepackage[english,ngerman]{babel}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
{\raggedright \@opening}% <search>
{\@opening}% <replace>
{}{}% <success><failure>
\patchcmd{\makelettertitle}%
{\end{minipage}\\[1em]}%
{\end{minipage}\\[2em]}%
{}{}
\renewcommand*{\makeletterclosing}{
\@closing\\[6em]%
{\bfseries \@firstname~\@familyname}%
\ifthenelse{\isundefined{\@jobtitle}}{}{\\\@jobtitle}% <-- added to orig. def
\ifthenelse{\isundefined{\@enclosure}}{}{%
\\%
\vfill%
{\color{color2}\itshape\enclname: \@enclosure}}}
\def\jobtitle#1{\def\@jobtitle{#1}}
\makeatother
\moderncvcolor{green}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\name{Name}{Surname}
\address{Address}{City}{Country}
\phone[mobile]{+00~(000)~0000~0000}
\email{name@domain.com}
\homepage{www.domain.com}
\begin{document}
% Label #001
\begin{}
\newcommand{\labelName}{Name}
\newcommand{\addressFirstLine}{Address 1}
\newcommand{\addressSecondLine}{Address 2}
\newcommand{\addressThirdLine}{Address 3}
\newcommand{\theName}{Sir}
\newcommand{\theSurname}{ or Madam}
\newcommand{\recipientJob}{News Editor}
\newcommand{\enclosedItems}{one-sheet, demo CD, ''Title'' reviews.}
\include{Infection-Label_letter_template}
\end{}
% Label #002
\begin{}
\newcommand{\labelName}{Name}
\newcommand{\addressFirstLine}{Address 1}
\newcommand{\addressSecondLine}{Address 2}
\newcommand{\addressThirdLine}{Address 3}
\newcommand{\theName}{Sir}
\newcommand{\theSurname}{ or Madam}
\newcommand{\recipientJob}{News Editor}
\newcommand{\enclosedItems}{one-sheet, demo CD, ''Title'' reviews.}
\include{Infection-Label_letter_template}
\end{}
\jobtitle{Band Leader}
\makeletterclosing
\end{document}
This one is called "Infection-Label_letter_template:"
\begin{document}
\recipient{\labelName}{\addressFirstLine\\\addressSecondLine\\\addressThirdLine}
\date{\today}
\opening{Dear \theName\theSurname,}
\closing{Sincerely,}
\enclosure[Attached]{\enclosedItems}
\makelettertitle
\parskip 11pt
I'm writing to introduce Band, a death metal band in the vein of Death, Cannibal Corpse, and Monstrosity. During the time the band has been active, we have independently-released our first album, "Title,'' which received positive reviews from magazines and international press. We are now willing to take one step ahead and reach a broader audience with our music.
Infection have finished recording a new album entitled "Title.'' Therefore, our band is currently seeking a recording contract with a quality label like \labelName.
I have enclosed a CD and full press kit. I hope you can give Band's music a listen and consider us for a position on your roster. If you have questions, you can contact me by email at nameo@domain.com or at the address and phone above. Thanks for your time.
\end{document}
I acknowledge that my code is not working, but that's I have at this very moment. I tried to adapt the idea from this link: http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907466
Any help will be appreciated!
mail merge– Leeser May 06 '14 at 22:17