命令是\closing
scrlttr2.cls
\newcommand*{\closing}[1]{{%
\setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative\nobreak\par%
\nobreak\vskip\baselineskip%
\stopbreaks\noindent%
\setlength{\@tempdima}{0pt}%
\expandafter\@tempdimaismaxwidthof\scr@signature@var\\\@nil
\expandafter\@tempdimaismaxwidthof\strut\ignorespaces#1\\\@nil
\setlength{\@tempdimb}{\hsize}%
\addtolength{\@tempdimb}{-\useplength{sigindent}}%
\ifdim\@tempdima>\@tempdimb\setlength{\@tempdima}{\@tempdimb}\fi%
\hspace{\useplength{sigindent}}%
\parbox{\@tempdima}{\raggedsignature\strut\ignorespaces%
#1\strut\\[\useplength{sigbeforevskip}]
\strut\usekomavar{signature}\strut}}\par
\nobreak\vskip\baselineskip%
}
如何才能signature
在结束短语之后(在同一行)立即提升变量,并在之后立即添加(来自)\encl{}
命令?\cc{}
scrlttr2
上面的代码有点复杂(因为有一些我不知道的指令)。同样,尝试按照 的示例lettr.cls
,以便更新\closing
中的命令如何在页面的这一部分具体打字?,并不容易。
答案1
让我们从最小示例-不管你怎么想,真正对社区有帮助的事情。以下内容摘自KOMA 脚本 文档(部分4.20. 结束,第 190 页):
\documentclass[foldmarks=true,foldmarks=blmtP,
fromphone,fromemail,fromlogo,
subject=titled,
version=last]{scrlttr2}% http://ctan.org/pkg/koma-script
\usepackage[english]{babel}% http://ctan.org/pkg/babel
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\setkomavar{fromname}{John Public}
\setkomavar{signature}{John Public\\
(former chairman)}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Valley 2\\
54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{[email protected]}
\setkomavar{fromlogo}{\includegraphics[height=5\baselineskip]{tiger}}
\setkomavar{location}{\raggedright
Club nember no.~4711\\
since 11.09.2001\\
chairman 2003--2005}
\setkomavar{date}{29th February 2011}
\setkomavar{place}{Public-Village}
\setkomavar{subject}{Missing general meeting}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}
输出结果如下:
如果我们想修改 的结构\closing
,我们应该修改命令中包含的内容\parbox
。让我们使用etoolbox
形式为\patchcmd
:
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\closing}% <cmd>
{\parbox}% <search>
{\parbox{\linewidth}{\raggedsignature\strut\ignorespaces\let\\\relax%
#1 \usekomavar{signature}}%
\@gobbletwo}%< <replace>
{}{}% <success><failure>
\makeatother
上述代码替换了\parbox
。\parbox{..}{...}\@gobbletwo
替换\parbox{..}{...}
使用了旧 的元素,\parbox
但未插入sigbeforevskip
用于产生垂直间隙的长度。相反,\usekomavar{signature}
在实际 之间设置了一个空格\closing{#1}
。此外,\\
是(但可能不是必要的)以避免强制段落中断。后者会吃掉旧的两个参数。\let
\relax
\@gobbletwo
\parbox
下面是显示输出结果的示例文档(请注意,根据要求,我还移动了\ps
下面的\encl
和\cc
):
\documentclass[foldmarks=true,foldmarks=blmtP,
fromphone,fromemail,fromlogo,
subject=titled,
version=last]{scrlttr2}% http://ctan.org/pkg/koma-script
\usepackage[english]{babel}% http://ctan.org/pkg/babel
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\closing}% <cmd>
{\parbox}% <search>
{\parbox{\linewidth}{\raggedsignature\strut\ignorespaces\let\\\relax%
#1 \usekomavar{signature}}%
\@gobbletwo}%< <replace>
{}{}% <success><failure>
\makeatother
\begin{document}
\setkomavar{fromname}{John Public}
\setkomavar{signature}{John Public\\
(former chairman)}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Valley 2\\
54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{[email protected]}
\setkomavar{fromlogo}{\includegraphics[height=5\baselineskip]{tiger}}
\setkomavar{location}{\raggedright
Club nember no.~4711\\
since 11.09.2001\\
chairman 2003--2005}
\setkomavar{date}{29th February 2011}
\setkomavar{place}{Public-Village}
\setkomavar{subject}{Missing general meeting}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\ps PS: I hope you accept this as an friendly
demand note.
\end{letter}
\end{document}
当然,还可以做其他调整。