如何刪除首頁多餘的空白?

如何刪除首頁多餘的空白?

以下 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}

相關內容