订购事宜listings
和float
其他包裹\parskip
将被忽略
我试图弄清楚为什么在我的列表(\lstlistoflistings
)中\parskip
被忽略了,最后我将其缩小到listings
包裹不与包裹配合float
,以及某些特定于订单的东西。
什么时候float
第一次出现问题
如果我使用这个(最初我这样做是因为我尝试尽可能按字母顺序组织包)。
\usepackage{float}
\usepackage{listings}
那么\parskip
在列表列表中会被忽略,但在其他列表中会受到尊重,如下所示:
如果我确保listings
在此之前已加载,float
则一切正常。我不熟悉检查软件包的内部,也不知道出了什么问题,也不知道哪个软件包有问题(如果有的话)。
- 引擎盖下出了什么问题?
- 谁的错?(如果是 Bug,应该去哪里报告?)。
平均能量损失
相当简单,但每个项目都包含几个项目来显示间距,并且有一组全面的列表,表明它似乎listings
很尴尬。
\documentclass[english,a4paper,11pt,twoside,openright]{book}
\usepackage{algorithm2e}
\usepackage{etoolbox}
\usepackage{float} %% The ordering matters here.
\usepackage{listings} %% The ordering matters here.
\usepackage{lipsum}
\usepackage[nottoc]{tocbibind}
\usepackage{todonotes}
% List of Algorithms (NB, requires french spelling of 'algorithmes')
\renewcommand*{\listalgorithmcfname}{List of algorithms}
\newcommand{\listofalgorithmes}{\tocfile{\listalgorithmcfname}{loa}}
% Suppose we want big paragraph spacing
\setlength{\parskip}{1\baselineskip}
% We want the list of listings to look like all the others.
\let\Chapter\chapter
\def\chapter{\addtocontents{lol}{\protect\addvspace{10pt}}\Chapter}
\makeatletter
\patchcmd{\@chapter}{\chaptermark{#1}}{%
\chaptermark{#1}%
\addtocontents{lol}{\protect\addvspace{10\p@}}%
}{\typeout{Chapters patched for list-of-listings.}}{\typeout{Could not patch chapters for list-of-listings.}}
\makeatother
\begin{document}
% All the possible list of somethings I can think of and use.
\tableofcontents
\listoffigures
\listoftables
\lstlistoflistings
\listoffigures
\listofalgorithmes
\listoftodos
\chapter{Chapter}
\section{Section}\section{Section}\section{Section}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\chapter{Chapter}
\section{Section}\section{Section}\section{Section}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\begin{table}[htb]\caption{A table}\end{table}
\begin{figure}[htb]\caption{A figure}\end{figure}
\begin{lstlisting}[caption={Some code}]
\end{lstlisting}
\todo[inline=true,caption={A todo note}]{Must do this.}
\begin{algorithm}[htb] \DontPrintSemicolon \KwIn{Input} \KwOut{Output} Code\; \caption{Some algorithm.} \end{algorithm}
\end{document}