我正在尝试将以下内容处理到 Avery 5160 邮寄标签中,使用\skipblank
其他人在此网站上发布的代码来抑制空行:
\documentclass[10pt]{letter}
\usepackage[avery5160label,noprintbarcodes]{envlab}
\usepackage{datatool}
\usepackage{makerobust}
\makeatletter
%commands to skip blank or missing fields
%* version replaces with space only
\newcommand\skipblank{\@ifstar\@spskip\@nlskip}
\newcommand\@nlskip[1]{\ifthenelse{\DTLiseq{#1}{}}{\relax}{#1\\}}
\newcommand\@spskip[1]{\ifthenelse{\DTLiseq{#1}{}}{\relax}{#1\space}}
\MakeRobustCommand{\@nlskip}
\MakeRobustCommand{\@spskip}
\makeatother
\makelabels
\begin{document}
\startlabels
\DTLsetseparator{|}
\DTLloadrawdb{maillist}{sitemailmerge.csv}
\DTLforeach{maillist} {\name=Contact,\site=SiteName,\addra=Addressa,\addrb=Addressb,\addrc=Addressc,\city=City,\st=StateProv,\zip=PostCode,\country=Country,\role=Role,\fname=Firstname,\lname=Lastname,\tit=Title}{%
\mlabel{
\skipblank*{\name},\ \skipblank*{\role}\\
\skipblank{\site}
\skipblank{\addra}
\skipblank{\addrb}
\skipblank{\addrc}
\city\ \st\ \zip\ \ \country
}
}
\end{document}
但是我一直收到以下 LaTeX 错误:
"
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.43 }
?
! Missing { inserted.
<recently read> }
l.43 }
?
! Missing } inserted.
"
据我了解,不匹配}
错误与脆弱的命令有关,因此使用了\MakeRobustCommand{}
,但这似乎没有帮助。这非常令人沮丧。非常感谢任何建议。