减少算法标题列表后的垂直空间

减少算法标题列表后的垂直空间

我想控制算法标题列表前后的间距,以使所有算法适合一页。

\documentclass[12pt,headsepline,a4paper,BCOR=10mm,twoside,titlepage,pdftex,cleardoubleplain]{scrbook}
\usepackage[english,ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{tocloft}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage


\pagenumbering{arabic}
\setcounter{page}{1}
\newpage

\input{chapters/chapter1}
\input{chapters/chapter2}
\appendix
\input{chapters/Appendix}
\listofalgorithms
\backmatter
\bibliographystyle{alpha}
\bibliography{library}
\end{document}

答案1

我不会这样做,因为这与其他章节标题不一致,但如果你真的想这样做,你可以这样做。

您有两个命令分别用于控制章节标题前后的间距\chapterheadstartvskip\chapterheadendvskip

您可以在本地修改它们以仅更改算法列表的外观:

\begingroup
\renewcommand*{\chapterheadstartvskip}{\vspace*{-80pt}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0pt}}
\listofalgorithms
\endgroup

这样,其他章节就不会受到此变化的影响。

以下 MWE

\documentclass[12pt,headsepline,a4paper,BCOR=10mm,twoside,titlepage,pdftex,cleardoubleplain]{scrbook}
\usepackage[english,ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{tocloft}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\begin{document}
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage


\pagenumbering{arabic}
\setcounter{page}{1}
\newpage

\begingroup
\renewcommand*{\chapterheadstartvskip}{\vspace*{-80pt}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0pt}}
\listofalgorithms
\endgroup

\chapter{a chapter}
\begin{algorithm}
  \caption{An algorithm}
\end{algorithm}

\end{document} 

对于 LoA 页面,得出以下结果:

enter image description here

调整上述参数以满足您的需要。

相关内容