我正在尝试使用mailmerge
带有 KOMAscrlttr2
字母类的包,但它失败并显示一条There's no line here to end.
消息,可能是因为地址字段显示为空白。我想我犯了一些基本的错误。示例代码如下:
\documentclass[foldmarks=false,backaddress=false,
fromalign=false,version=last]{scrlttr2}
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage{mailmerge}
\begin{document}
\setkomavar{fromname}{H. G. Wells}
\setkomavar{fromaddress}{Spade House\\ 5281 Radnor Cliff Crescent (West Side)\\ Sandgate, Kent}
\mailfields{address}
\def\today{1st January, 1895}
\begin{letter}{
% George Bernard Shaw,\\
% Shaw's Corner,\\
% Bibbs Hall Lane,\\
% Ayot St. Lawrence, Hertfordshire\\
\mailrepeat{\field{address}}
}
\opening{Dear Shaw,}
You suck!
\closing{Sincerely}
\end{letter}
\mailentry{GBS}
\end{document}
答案1
你使用的方式不\mailrepeat
正确。它的参数应该是你想要重复的文本,不是地址而是整封信:
\documentclass[foldmarks=false,backaddress=false,
fromalign=false,version=last]{scrlttr2}
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage{mailmerge}
\begin{document}
\setkomavar{fromname}{H. G. Wells}
\setkomavar{fromaddress}{Spade House\\ 5281 Radnor Cliff Crescent (West Side)\\ Sandgate, Kent}
\mailfields{address}
\def\today{1st January, 1895}
\mailrepeat{
\begin{letter}{
% George Bernard Shaw,\\
% Shaw's Corner,\\
% Bibbs Hall Lane,\\
% Ayot St. Lawrence, Hertfordshire\\
\field{address}
}
\opening{Dear Shaw,}
You suck!
\closing{Sincerely}
\end{letter}}
\mailentry{GBS}
\end{document}