如何删除第一页上多余的空白?

如何删除第一页上多余的空白?

以下 MWE 精确复制了我创建的 LaTeX 文件。我使用@egreg 对我关于以编程方式创建虚拟文本的问题的解决方案。

quoting问题是第二页上的引用部分被推到了第二页。我想这是因为我使用的环境定义发生了改变,即

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

不过,我在样式文件中使用该引用定义已有一段时间了,而且对我来说,它基本上是有效的。它可能在许多现有文档中使用。所以我想保持原样。

我有以下问题。

1) 首先,一个小问题。我正确地认为,vskip=10in
在下一行中使用是一个错误,因为它被
新的引用定义覆盖了?

\usepackage[vskip=10in]{quoting}

我只使用来自引用包的引用环境,如下所示,没有其他的。

如果是这种情况,我将从vskip=10in该包裹中删除声明。

2)我的主要问题是是否有一种优雅的方法可以避免在第一页的底部留下大量空白。

\mbox{}我认为这是由于声明中的 原因造成的\tcolorboxenvironment

我在想,我可以保留序言中引用的更改定义,但暂时改变定义,以便允许第二页上的框移动到第一页。这可能吗?或者有更好的方法吗?

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

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

答案1

我建议从传递给定义的选项列表中code={\mbox{}}删除:nobeforeafter\tcolorbox

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

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

相关内容