# Extra interline spacing in two sided mode with scrlttr2, and tcolorbox environment redefining quoting environment

While experimenting with two sided settings in scrlttr2 while using quoting in combination with tcolorbox, I came across an oddity. The following example shows interline spacing in text outside the quoting environment boxes. This only shows up in two sided mode, and only with beforeafter skip=\baselineskip in the tcolorboxenvironment invocation that redefines quoting. I'm puzzled what's causing this, since it's not obviously connected to anything about the quoting environment, or two sidedness.

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

firstfoot=false, enlargefirstpage=true,
foldmarks=false,foldmarks=blmtP, fromalign=center, fromphone,
{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}
\renewcommand{\phonename}{Landline}
\renewcommand{\mobilephonename}{Mobile}
\setkomavar{frommobilephone}{Mobile}
\setkomavar{fromemail}{Email}
\setkomavar{signature}{(\usekomavar{fromname})}
\setkomavar{subject}{Subject}
\setkomavar{date}{\today}

\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*{mobilephoneseparator}\usekomavar{mobilephoneseparator}\usekomavar{frommobilephone}\\
\usekomavar*{emailseparator}\usekomavar{emailseparator}\usekomavar{fromemail}
}
}%
}

\makeatletter
\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}


ADDENDUM: A hopefully simplified version which looks more like what I'm actually seeing.

\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}

\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
\makeatletter\@setplength{sigindent}{0.5\linewidth}\makeatother
\makeatother

\begin{letter}{
}

\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}


The first page of the resulting 2 page file is shown below, which displays the problem

When using twoside the class activates (like other classes often do) \flushbottom. That means that LaTeX will try to fill the page, and for this stretches the parskip.

The effect disappears if you remove the beforeafter skip=\baselineskip, as then the letter fits on one page.

In oneside mode you get the same if add \flushbottom.

To avoid the problem add \raggedbottom

• Hi Ulrike. Thank you very much for the answer. Can you tell me where I should put \raggedbottom for this to work? And why is \flushbottom used in two sided mode, and not one sided mode? What is the logic? – Faheem Mitha Mar 5 '19 at 10:02
• Try it out - there aren't so many sensible places. And flushbottom is used traditionally in twoside mode, as there two pages can be seen side by side - simply open a book to see it. – Ulrike Fischer Mar 5 '19 at 10:06
• I tried it in a couple of places, but it doesn't change anything. Where is the \flushbottom placed in the environment? And is there no way to simply switch that off? – Faheem Mitha Mar 5 '19 at 10:17
• Add \raggedbottom directly after \begin{document}. – Ulrike Fischer Mar 5 '19 at 10:21
• Ok, I tried putting it just before the beginning of the last para on the first page, and that worked. But a fire-and-forget solution would be preferable. Directly after \begin{document} works, but is that a general solution? – Faheem Mitha Mar 5 '19 at 10:27

Using \flushbottom in twoside-mode was a bug in scrlttr2 since version 3.17. It has been fixed in scrlttr2 v3.27.3111 by adding \raggedbottom to the definition of the letter environment. Before this change

\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}


resulted in a warning message:

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

and

With KOMA-Script 3.27.3111 (this is a KOMA-Script pre-release), it results in:

without warning message.

Note, there are additional changes in upcoming KOMA-Script 3.27 (linked page in German).

• Hi, Schweinebacke, thank you for the answer. The version of KOMA I'm currently using is 2018/03/30 v3.25 (Debian pre-release of TeX LIve 2019). 2018.20190227-2 is available in Debian unstable. Would that version contain the KOMA version you mention? And do you concur that adding \raggedbottomdirectly after \begin{document} is the best workaround for now? – Faheem Mitha Mar 5 '19 at 12:04
• @FaheemMitha I do not know which version of KOMA-Script is in which version of a Debian package. But I do not think, that any distributor could have packaged on 2019-02-27 a KOMA-Script pre-release that has been made today after the bug has been recognized. And I would never expect (or recommend), that a distributor would package a KOMA-Script pre-release. You either have to wait for the release (and maybe several month until debian make an update) or use the pre-release from the location I gave in my answer. – Schweinebacke Mar 5 '19 at 12:37
• Hi Schweinebacke. The fix was made today? Was this in response to my post, then? And if so, can you post a link to an issue, or a VCS diff, or something? – Faheem Mitha Mar 5 '19 at 12:56
• @FaheemMitha So, yes, currently with KOMA-Script v3.17–3.26b using \raggedbottom is the best workaround. Whether you place it after \begin{documemt} or use \AtBeginLetter{\raggedbottom} is your choice. – Schweinebacke Mar 5 '19 at 12:57
• Well, I'm still using v3.25. – Faheem Mitha Mar 5 '19 at 13:03