scrlttr2 不指定地址时删除较大的间隙

scrlttr2 不指定地址时删除较大的间隙

我正在用这个scrlttr2班级写一封求职信。我没有收件人地址,因为这是写给委员会的。由于我没有收件人地址,所以地址应该在的地方有一个很大的白色空白,我想把它去掉。如何?

我的 MWE 如下

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[svgnames,dvipsnames]{xcolor}
%\usepackage{palatino}
\usepackage[inline]{enumitem}
\usepackage{todonotes}
\usepackage[colorlinks, allcolors=DarkBlue]{hyperref}

\setkomavar{fromname}{My Name}
\setkomavar{fromaddress}{%
  My address
  Somewhere, ST 12345
}
\setkomavar{fromphone}{800-867-5309}
\setkomavar{fromemail}{[email protected]}
\setkomavar{signature}{My Name}
% \setkomavar{subject}{Cover Letter}
\renewcommand*{\raggedsignature}{\raggedright}

\KOMAoptions{
  paper=letter,
  backaddress=off,
  fromalign=right,
  addrfield=off,
  fromphone=on,
  foldmarks=false,
  fromemail=true,
  addrfield=off,
  fromrule=aftername,
}

\setkomafont{fromname}{\sffamily \Large}
\setkomafont{fromaddress}{\sffamily}%% statt \small
\setkomafont{pagenumber}{\sffamily}
\setkomafont{subject}{\bfseries}

\setlist[itemize]{leftmargin=1.5em}

\newcommand{\skillitem}[1]{ {\bfseries \sffamily #1} }

\begin{document}
\begin{letter}{}
  \opening{To Whom it May Concern,}

  \closing{Sincerely,}
  \cc{Someone else, [email protected]}
\end{letter}

\end{document}

在此处输入图片描述

答案1

您必须更改参考线(或带有日期的线)的垂直位置。因此,您必须调整伪长度refvpos

有关伪长度和命令的更多信息\@setplength\@addtoplength\useplength参阅 KOMA-Script 文档第 22.1 节“资深用户的伪长度”。还有一张显示伪长度的图。

例子:

您可以设置refvpos为以下值toaddrvpos

在此处输入图片描述

代码:

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\setkomavar{fromname}{My Name}
\setkomavar{fromaddress}{%
  My address
  Somewhere, ST 12345
}
\setkomavar{fromphone}{800-867-5309}
\setkomavar{fromemail}{[email protected]}
\setkomavar{signature}{My Name}
\renewcommand*{\raggedsignature}{\raggedright}

\KOMAoptions{
  paper=letter,
  backaddress=off,
  fromalign=right,
  addrfield=off,
  fromphone=on,
  foldmarks=false,
  fromemail=true,
  addrfield=off,
  fromrule=aftername,
}

\setkomafont{fromname}{\sffamily \Large}
\setkomafont{fromaddress}{\sffamily}
\setkomafont{pagenumber}{\sffamily}
\setkomafont{subject}{\bfseries}

\makeatletter
\@setplength{refvpos}{\useplength{toaddrvpos}}% <- added
\makeatother

\begin{document}
\begin{letter}{}
  \opening{To Whom it May Concern,}
  \closing{Sincerely,}
  \cc{Someone else, [email protected]}
\end{letter}
\end{document}

或者您可以通过以下方式将其上调toaddrheight

在此处输入图片描述

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\setkomavar{fromname}{My Name}
\setkomavar{fromaddress}{%
  My address
  Somewhere, ST 12345
}
\setkomavar{fromphone}{800-867-5309}
\setkomavar{fromemail}{[email protected]}
\setkomavar{signature}{My Name}
\renewcommand*{\raggedsignature}{\raggedright}

\KOMAoptions{
  paper=letter,
  backaddress=off,
  fromalign=right,
  addrfield=off,
  fromphone=on,
  foldmarks=false,
  fromemail=true,
  addrfield=off,
  fromrule=aftername,
}

\setkomafont{fromname}{\sffamily \Large}
\setkomafont{fromaddress}{\sffamily}l
\setkomafont{pagenumber}{\sffamily}
\setkomafont{subject}{\bfseries}

\makeatletter
\@addtoplength[-]{refvpos}{\useplength{toaddrheight}}% <- added
\makeatother

\begin{document}
\begin{letter}{}
  \opening{To Whom it May Concern,}
  \closing{Sincerely,}
  \cc{Someone else, [email protected]}
\end{letter}
\end{document}

补充说明

下一个 KOMA-Script 版本 3.26将介绍命令\newplength\setplength\addtoplength(请注意缺少@)。然后您可以在上面的示例中不使用\makeatletter和使用这些命令。\makeatother

相关内容