我正在尝试从单个文档开始生成求职信。由于我要将同一封信发送给具有不同地址的不同人,因此我认为最好使用此文档作为模板,然后仅更改从另一个文件中提取数据的信息,这与动态 HTML 文档的工作方式非常相似。
现在我有两个文件,一个主要文件将包含所有信件并提取信息,另一个包含内容。以下是我的文件:
该文件名为“感染标签字母:”
\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{[email protected]}
\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}
这个叫做“感染标签字母模板:”
\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 [email protected] or at the address and phone above. Thanks for your time.
\end{document}
我承认我的代码不起作用,但这就是我目前所拥有的。我尝试从此链接改编这个想法: http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907466
任何帮助将不胜感激!
答案1
看看这个问题来自数据库的邮件合并文档解决方案是扬尼斯·拉扎里德斯. 讨论mail merge
等等。