How to remove excess whitespace on the first page?

The following MWE closely reproduces a LaTeX file I created. I'm using @egreg's solution to my question about programatically creating dummy text.

The issue is that the quoted section on the second page is pushed to the second page. I suppose this is because of the altered definition of the quoting environment that I used, namely

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


However, I've been using that definition of quoting in a style file for some time, and it's mostly worked for me. And it's probably used in a number of existing documents. So I'd like to keep it as it is.

I have the following questions.

1) First, a minor one. I am correct to think that using vskip=10in
in the following line was an error, in the sense that it gets
overwritten by the new definition of quoting?

\usepackage[vskip=10in]{quoting}


I'm only using the quoting environment from the quoting package, as shown below, nothing else.

If this the case, I'll remove vskip=10in from that package declaration.

2) My main question is whether there is a graceful way to avoid having a large amount of empty space at the bottom of the first page.

I suppose this is being caused by the \mbox{} in the \tcolorboxenvironment declaration.

I was thinking that I could just leave the changed definition of quoting in the preamble as it is, but temporarily alter the definition in such a way as to allow that box on the second page to move to the first page. Is that possible? Or is there a better way to do it?

    \documentclass[12pt, sections, headheight=30pt, headinclude,
firstfoot=false, enlargefirstpage=true, foldmarks=false,
foldmarks=blmtP, fromalign=center, fromphone, fromemail, version=last,

\usepackage[most]{tcolorbox}
\usepackage[vskip=10in]{quoting}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\tcolorboxenvironment{quoting}{code={\mbox{}},nobeforeafter,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{HelloWorld!}{3}{3}
\end{quoting}

\dummy{HelloWorld!}{3}{3}

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

\closing{Yours Sincerely,}

\end{letter}
\end{document}

• @HafidBoukhoulda Well, I lose my before and after spacing. – Faheem Mitha Feb 24 at 20:13
• Why do you need code={\mbox{}} ? – Hafid Boukhoulda Feb 24 at 20:13
• @HafidBoukhoulda Without it, I get no spacing before my quoting box. I'm pretty someone on the site suggested it. I would never have thought of that on my own. It's possible I just copied it from somewhere. – Faheem Mitha Feb 24 at 20:17
• That is because you are adding nobeforeafter – Hafid Boukhoulda Feb 24 at 20:18
• So try \tcolorboxenvironment{quoting}{boxrule=2pt,sharp corners,breakable,skin=enhanced,colback=white} – Hafid Boukhoulda Feb 24 at 20:20

I suggest to remove code={\mbox{}} and nobeforeafter from the option list passed to the \tcolorbox definition:

\documentclass[12pt, sections, headheight=30pt, headinclude,
firstfoot=false, enlargefirstpage=true, foldmarks=false,
foldmarks=blmtP, fromalign=center, fromphone, fromemail, version=last,

\usepackage[most]{tcolorbox}
\usepackage[vskip=10in]{quoting}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\tcolorboxenvironment{quoting}{
%code={\mbox{}},nobeforeafter,

before skip=\baselineskip, % or before skip = 1cm or something else

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{HelloWorld!}{3}{3}
\end{quoting}

\dummy{HelloWorld!}{3}{3}

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

\closing{Yours Sincerely,}

\end{letter}
\end{document}

• I see you've add some "before skip". Would also adding some "after skip" be reasonable, or is there some reason to prefer "before skip"? – Faheem Mitha Feb 25 at 6:31
• @FaheemMitha you can add after skip or if the same spaces before and after the boxes are required you can replace before skip with beforeafter skip – Hafid Boukhoulda Feb 25 at 6:42
• Yes, beforeafter skip seems like a good option. Thank you. – Faheem Mitha Feb 25 at 9:14