将 scrlttr2 中的 CC 移至顶部

将 scrlttr2 中的 CC 移至顶部

我想在地址和“yourref”部分之间添加一个 CC 行。将命令放在\cc紧接着 CC 文本的位置后,\begin{letter}会将 CC 文本放置在与发件人地址相同的位置。是否有任何特殊的 cc 字形,或者我如何在信件的开头放置一些 cc 行?

\documentclass[a4paper]{scrlttr2}
\usepackage{polyglossia}
\setmainlanguage{german}

\setkomavar{fromname}{Joe Bloggs}
\setkomavar{fromaddress}{21 Bridge Street \\ Smallville \\ Dunwich DU3 4WE}
\setkomavar{fromphone}{0123 45679}

\begin{document}

\begin{letter}{To this address}

\cc{Another person}

\setkomavar{subject}{subject}
\setkomavar{customer}[Personalnummer]{ABCDEF}
\setkomavar{place}{here}
\opening{Sehr geehrte Damen und Herren,}

\closing{Mit freundlichen Grüßen,}
\end{letter}

\end{document}

答案1

也许您可以使用位置字段:

\documentclass[a4paper,
  locfield=wide% <- added
]{scrlttr2}
\usepackage{polyglossia}
\setmainlanguage{german}

\setkomavar{fromname}{Joe Bloggs}
\setkomavar{fromaddress}{21 Bridge Street \\ Smallville \\ Dunwich DU3 4WE}
\setkomavar{fromphone}{0123 45679}
\setkomavar{location}{{\setlength{\textwidth}{\useplength{locwidth}}{\cc{Another person}}}}% <- added
%\setkomavar*{ccseparator}{\makebox[1cm][r]{Kopien an}}

%% --- visualize field positions ---
%\LoadLetterOption{visualize}
%\showfields{address,location}

\begin{document}
\begin{letter}{To this address}
\setkomavar{subject}{subject}
\setkomavar{customer}[Personalnummer]{ABCDEF}
\setkomavar{place}{here}
\opening{Sehr geehrte Damen und Herren,}
\ldots
\closing{Mit freundlichen Grüßen,}
\end{letter}
\end{document}

结果:

在此处输入图片描述

您还可以更改位置字段的位置、高度和宽度:

\documentclass[a4paper]{scrlttr2}
\usepackage{polyglossia}
\setmainlanguage{german}

\setkomavar{fromname}{Joe Bloggs}
\setkomavar{fromaddress}{21 Bridge Street \\ Smallville \\ Dunwich DU3 4WE}
\setkomavar{fromphone}{0123 45679}
\setkomavar{location}{\cc{Another person}}

\makeatletter
\AtBeginLetter{%
  \@setplength{locwidth}{\useplength{firstheadwidth}}
  \@setplength[3]{locheight}{\baselineskip}
  \@setplength[-]{lochpos}{\useplength{toaddrhpos}}
  \@setplength{locvpos}{\useplength{refvpos}}
  \@addtoplength[-2]{locvpos}{\baselineskip}
  \@addtoplength{refvpos}{\baselineskip}
}
\makeatother

%% --- visualize field positions ---
%\LoadLetterOption{visualize}
%\showfields{address,location}

\begin{document}
\begin{letter}{To this address}
\setkomavar{subject}{subject}
\setkomavar{customer}[Personalnummer]{ABCDEF}
\setkomavar{place}{here}
\opening{Sehr geehrte Damen und Herren,}
\ldots
\closing{Mit freundlichen Grüßen,}
\end{letter}
\end{document}

结果:

在此处输入图片描述

(补充说明:从 3.26 版开始,可以使用\setplength\addtoplength。然后可以从示例中删除\makeatletter和。\makeatother

答案2

只是为了完整性,实际上这是我使用textpos包的 hacked 解决方案:

\documentclass[a4paper]{scrlttr2}
\usepackage{polyglossia}
\setmainlanguage{german}
\usepackage[absolute,overlay]{textpos} % <-- added this

\setkomavar{fromname}{Joe Bloggs}
\setkomavar{fromaddress}{21 Bridge Street \\ Smallville \\ Dunwich DU3 4WE}
\setkomavar{fromphone}{0123 45679}

% Added this: This is needed to move the references line down, so we have place for the CC block
\makeatletter
\@addtoplength{refvpos}{1cm}
\makeatother

\begin{document}

\begin{letter}{To this address}

% Added this
\begin{textblock*}{\textwidth}(2cm,9.5cm) % {block width} (coords) 
Kopie an: Another person
\end{textblock*}

\setkomavar{subject}{subject}
\setkomavar{customer}[Personalnummer]{ABCDEF}
\setkomavar{place}{here}
\opening{Sehr geehrte Damen und Herren,}

\closing{Mit freundlichen Grüßen,}
\end{letter}

\end{document}

结果如下: 结果

相关内容