scrlttr2
我尝试使用签名定义中的环境在信件中添加三个并排签名minipage
。我收到错误:Extra }, or forgotten \endgroup
指向结束行。如果我不使用 minpages,错误就会消失。这是 MWE:
\documentclass[%
paper=letter,
pagesize,
fontsize=10pt,
standard
]{scrlttr2}
\usepackage{filecontents}
\setkomavar{fromname}{Sender's Name}
\setkomavar{fromaddress}{Some street\\in some town\\with zip code}
\begin{filecontents}{standard.lco}
\setkomavar{signature}{%
\begin{minipage}[b]{0.33\linewidth}
First name\\
Position 1
\end{minipage}
\begin{minipage}[b]{0.33\linewidth}
Second name\\
Position 2
\end{minipage}
\begin{minipage}[b]{0.33\linewidth}
Third name\\
Position 3
\end{minipage}
}
\@setplength[1]{sigindent}{0.01\textwidth}
\end{filecontents}
\begin{document}
\begin{letter}{%
Recipient's name,\\
Some position\\
More address info
}
\opening{Dear Recipient}
\lipsum[1-2]
\closing{Sincerely,}
\end{letter}
\end{document}
即使编译失败,文档仍可正确呈现。我这样做对吗?
答案1
除了minipage
s,您还可以使用\parbox
es:
\documentclass[%
paper=letter,
pagesize,
fontsize=10pt,
standard
]{scrlttr2}
\usepackage[english]{babel}
\usepackage{lipsum}
\newcommand\Sigline[4][t]{%
\parbox[#1]{.333\linewidth}{\raggedright#2}%
\parbox[#1]{.333\linewidth}{\raggedright#3}%
\parbox[#1]{.333\linewidth}{\raggedright#4}%
}
\setkomavar{fromname}{Sender's Name}
\setkomavar{fromaddress}{Some street\\in some town\\with zip code}
\setkomavar{signature}{%
\Sigline{First name}{Second name}{Third name} \\
\Sigline{Position 1}{Position 2}{Position 3} \\
}
\begin{document}
\begin{letter}{%
Recipient's name,\\
Some position\\
More address info
}
\opening{Dear Recipient}
\lipsum[2]
\closing{Sincerely,}
\end{letter}
\end{document}
答案2
这是一个独立于任何特定文档类别的解决方案。
\documentclass{minimal}
\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore
et dolore magna aliquyam erat, sed diam voluptua.
\def\s#1#2{\vbox{\hsize=4.5cm
\kern2cm
\hrule\kern1ex
\hbox to \hsize{\strut\hfil #1 \hfil}
\hbox to \hsize{\strut\hfil #2 \hfil}}}
\hbox to \hsize{\s{John Doe}{President}\hfil
\s{Jane Doe}{COO}\hfil
\s{James Dow}{CFO}}
\end{document}