标题前的列表空间列表

标题前的列表空间列表

我知道我可以通过以下方式控制列表标题的空间:

\setlength{\cftbeforetoctitleskip}{35pt} % TOC: Table of Contents
\setlength{\cftbeforeloftitleskip}{35pt} % LOF: Listing of Figures
\setlength{\cftbeforelottitleskip}{35pt} % LOT: Listing of Tables

但是 的等价物是什么List of Listing

\setlength{\cftbeforeloltitleskip}{35pt} % LOL: List of Listings

不起作用...

所以现在我的标题高度不一致。该如何解决?

答案1

这是一个解决方案。使用\setlength{\cftbeforetoctitleskip}{<dimen>}因为 \lstlistoflistings使用\tableofcontents

\documentclass{article}

\usepackage{tocloft}
\usepackage{listings}
\setlength{\cftbeforetoctitleskip}{5cm}
\begin{document}
A
\lstlistoflistings
\begin{lstlisting}[caption={bla bla},label=list]
for i:=maxint to 0 do
begin
{ do nothing }
end;

Write(’Case insensitive ’);
WritE(’Pascal keywords.’);
\end{lstlisting}

\end{document}

答案2

好的,在你们的帮助下,我想这一定是一个搞乱了我的列表行为/样式的包。

经过一番调试,我发现这个包:这个包float把它搞砸了!

梅威瑟:

\documentclass[12pt]{report}

\title{List of listings problem}
\author{Gerjan}
\date{June 2016}

\usepackage[english]{babel}    
% \usepackage{float} % Including this package influences the behavior of LOL!
\usepackage{listings}
\usepackage{tocbibind}
\usepackage{tocloft}


\begin{document}

\maketitle

\cleardoublepage
\pagenumbering{Roman}

\setlength{\cftbeforetoctitleskip}{0em} 
\setlength{\cftbeforeloftitleskip}{0em}
\setlength{\cftbeforelottitleskip}{0em}

\setlength{\cftaftertoctitleskip}{10em} % Should affect toc AND lol

% toc and lol styling
\renewcommand\cfttoctitlefont{\normalfont\large}

% list of figures styling
\renewcommand\cftloftitlefont{\normalfont\Huge}

% list of tables styling
\renewcommand\cftlottitlefont{\normalfont\Huge}

% title of toc
\renewcommand\contentsname{Contents}

% title of lof
\renewcommand\listfigurename{List of Figures}

% title of lot
\renewcommand\listtablename{List of Tables}

% title of lol
\renewcommand\lstlistlistingname{List of Listings}

% Table of contents (toc)
\cleardoublepage
\phantomsection
\tableofcontents

% List of figures (lof)
\cleardoublepage
\phantomsection
\listoffigures

% List of tables (lot)
\cleardoublepage
\phantomsection
\listoftables

% List of listings (lol)
\cleardoublepage
\phantomsection
\lstlistoflistings

\addcontentsline{toc}{chapter}{\lstlistlistingname}

\cleardoublepage

\end{document}

尝试包含或不包含该float包并查看区别。

有人知道为什么吗?

相关内容