使用 scrlttr2 在双面模式下增加行间间距,并且 tcolorbox 环境重新定义引用环境

使用 scrlttr2 在双面模式下增加行间间距,并且 tcolorbox 环境重新定义引用环境

在尝试使用 中的双面设置并将scrlttr2引号与 结合使用时tcolorbox,我发现了一个奇怪的现象。以下示例显示引号环境框外文本中的行间距。这只在双面模式下显示,并且只在重新定义的调用beforeafter skip=\baselineskip中显示。我很困惑是什么导致了这种情况,因为它显然与引号环境或双面性无关。tcolorboxenvironmentquoting

%\documentclass[12pt, sections, headheight=30pt, headinclude, 
%firstfoot=false, enlargefirstpage=true, 
%foldmarks=false,foldmarks=blmtP, fromalign=center, fromphone, 
%fromemail, version=last, backaddress=false, subject=titled 
%{scrlttr2}

\documentclass[12pt, sections, headheight=30pt, headinclude, 
firstfoot=false, enlargefirstpage=true, 
foldmarks=false,foldmarks=blmtP, fromalign=center, fromphone, 
fromemail, version=last, backaddress=false, subject=titled, twoside] 
{scrlttr2}

\usepackage[most]{tcolorbox}
\usepackage{quoting}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\tcolorboxenvironment{quoting}{beforeafter skip=\baselineskip, boxrule=2pt, sharp corners, breakable, skin=enhanced, colback=white}
%\tcolorboxenvironment{quoting}{boxrule=2pt, sharp corners, breakable, skin=enhanced, colback=white}

\ExplSyntaxOn
\NewDocumentCommand{\dummy}{m m m}
{
  \prg_replicate:nn { #3 }
  {
    \prg_replicate:nn { #2 } { #1 \hfill } \dummy_endline:
  }
}
\cs_new:Npn \dummy_endline:
{ { \parfillskip=0pt\par } }

\ExplSyntaxOff

\begin{document}
\setkomavar{fromname}{Name}
\setkomavar{fromaddress}{Address}
\renewcommand{\phonename}{Landline}
\renewcommand{\mobilephonename}{Mobile}
\setkomavar{frommobilephone}{Mobile}
\setkomavar{fromemail}{Email}
\setkomavar{signature}{(\usekomavar{fromname})}
\setkomavar{subject}{Subject}
\setkomavar{date}{\today}

\setkomavar{firsthead}{%
  \parbox{\linewidth}{\centering
    \textbf{\jobname.tex} \input{"| hg log -v -l 1 \jobname.tex --template '{node}  {date|isodate}'"}
    \ifhmode \\ \fi
    {\fontfamily{pzc}\selectfont
      \hspace{\textwidth}
      \usekomavar{fromname}\\
      \usekomavar{fromaddress}\\
      \usekomavar*{mobilephoneseparator}\usekomavar{mobilephoneseparator}\usekomavar{frommobilephone}\\
      \usekomavar*{emailseparator}\usekomavar{emailseparator}\usekomavar{fromemail}
    }
  }%
}

\makeatletter
\@addtoplength{firstheadvpos}{30pt}
\@addtoplength{toaddrvpos}{40pt}
\@addtoplength{refvpos}{10pt}
\@addtoplength{sigbeforevskip}{20pt}
\makeatletter\@setplength{sigindent}{0.5\linewidth}\makeatother
\makeatother

\def\today{20th February, 2019}
\begin{letter}{
    Someone\\
    Company\\
    Building\\
    Street\\
    City
  }

  \opening{Hi}

  \dummy{HelloWorld!}{3}{5}
  \begin{quoting}
    \dummy{AlohaWorld!}{3}{3}
  \end{quoting}

  \dummy{BonjourWorld!}{3}{3}

  \begin{quoting}
    \begin{tabular}{p{4.5in}r}
      \textbf{\dummy{CiaoWorld!}{3}{1}  }  & \\
      \dummy{CiaoWorld!}{3}{2}             & \dummy{CiaoWorld!}{1}{1}
    \end{tabular}
  \end{quoting}

  \closing{Yours Sincerely,}

\end{letter}
\end{document}

附录:希望简化的版本看起来更像我实际看到的。

\documentclass[12pt,sections,headheight=30pt,headinclude,firstfoot=false,enlargefirstpage=true,foldmarks=false,foldmarks=blmtP,fromalign=center,,version=last, backaddress=false, subject=titled, twoside=semi]{scrlttr2}

%\documentclass[12pt,sections,headheight=30pt,headinclude,firstfoot=false,enlargefirstpage=true,foldmarks=false,foldmarks=blmtP,fromalign=center,version=last, backaddress=false, subject=titled]{scrlttr2}
\usepackage{quoting}
\usepackage[most]{tcolorbox}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}

\tcolorboxenvironment{quoting}{beforeafter skip=\baselineskip, boxrule=2pt,sharp corners,breakable,skin=enhanced,colback=white}

%\tcolorboxenvironment{quoting}{boxrule=2pt,sharp corners,breakable,skin=enhanced,colback=white}

\begin{document}
%\setkomavar{subject}{Subject Subject Subject Subject Subject Subject Subject Subject Subject Subject Subject  }
\setkomavar{subject}{Subject}

\makeatletter
\@addtoplength{firstheadvpos}{30pt}
\@addtoplength{toaddrvpos}{40pt}
\@addtoplength{refvpos}{10pt}
\@addtoplength{sigbeforevskip}{20pt}
\makeatletter\@setplength{sigindent}{0.5\linewidth}\makeatother
\makeatother

\begin{letter}{
    To Address
  }

  \opening{Hi,}

  Line 1.\\
  Line 2.\\
  Line 3.\\

  Line 1.\\
  Line 2.\\

  \begin{quoting}
    Line 1\\
    Line 2\\
  \end{quoting}
  Line 1\\
  Line 2\\
  \begin{quoting}
    Line 1\\
    Line 2\\
  \end{quoting}

\closing{Yours Sincerely,}
\end{letter}

\end{document}

生成的 2 页文件的第一页如下所示,显示了问题

在此处输入图片描述

答案1

当使用 twoside 时,该类会激活(就像其他类经常做的那样)\flushbottom。这意味着 LaTeX 将尝试填充页面,并为此拉伸 parskip。

如果删除该字母,则效果会消失,因为beforeafter skip=\baselineskip,该字母适合放在一页上。

在单侧模式下,如果添加,则会获得相同的结果\flushbottom

为了避免这个问题,添加\raggedbottom

答案2

自版本 3.17 以来,twoside-mode 中的使用\flushbottom存在错误scrlttr2。该问题已在scrlttr2v3.27.3111 中通过添加\raggedbottom到环境定义进行修复letter。在此更改之前

\documentclass[twoside]{scrlttr2}

\usepackage{mwe}

\begin{document}
\begin{letter}{You\\There}
  \opening{Hi,}
  \blindtext\par\blindtext

  \noindent\rule{\textwidth}{.5\textheight}

  \blindtext
  \closing{Bye}
\end{letter}

\end{document}

导致出现警告信息:

Underfull \vbox (badness 10000) has occurred while \output is active [1

使用 KOMA-Script 3.26b

使用 KOMA-Script 3.27.3111(这是一个KOMA-Script 预发布),其结果是:

来自 KOMA-Script 3.27.3111

没有警告信息。

请注意,还有额外的即将推出的 KOMA-Script 3.27 中的变化(德文链接页面)。

相关内容