
Observei algum comportamento inesperado com a classe scrbook (xelatex) e a lista de listagens do listings
pacote. O espaçamento entre os títulos dos capítulos do LOF e da lista de listagens e as primeiras entradas de cada lista não são iguais. O pacote de listagens produz uma lacuna muito maior, mesmo sem personalizar a aparência dos títulos dos capítulos, como no MWE. Alguém tem uma idéia de qual poderia ser o problema e como corrigi-lo? Obrigado!
MWE:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{listings}
\setkomafont{chapter}{\Large\bfseries\MakeUppercase}
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\topskip+2pt}}
\begin{document}
\listoffigures
\listoftables
\lstlistoflistings
\chapter{A Chapter}
\begin{figure}
\centering\includegraphics[width=0.5\linewidth]{example-image}
\caption{First figure}
\end{figure}
\begin{table}
\caption{First table}
\centering
\begin{tabular}[width=0.5\linewidth]{ccc}
Cell 1 & Cell 2 & Cell 3
\end{tabular}
\end{table}
\begin{lstlisting}[caption={First listing}]
Some code
\end{lstlisting}
\end{document}
Responder1
Existem dois avisos no arquivo de log do seu código:
Scrbook da classe Aviso:
\float@listhead
detectado! A implementação de\float@listhead
tornou-se obsoleta no KOMA-Script v3.01 14/11/2008 e foi substituída por vários recursos mais flexíveis do pacotetocbasic
. Talvez a implementação\float@listhead
seja removida do KOMA-Script em breve. O carregamento do pacotescrhack
pode ajudar a evitar esse aviso, se você estiver usando um pacote que ainda implementa a\float@listhead
interface obsoleta na linha de entrada 18.
e
Scrbook da classe Aviso:
\float@addtolists
detectado! A implementação de\float@addtolist
tornou-se obsoleta no KOMA-Script v3.01 14/11/2008 e foi substituída por vários recursos mais flexíveis do pacotetocbasic
. Desde a versão 3.12, o suporte para\float@addtolist
interface obsoleta foi restrito a apenas alguns dos recursos do KOMA-Script e foi removido de outros. O carregamento do pacotescrhack
pode ajudar a evitar esse aviso, se você estiver usando um pacote que ainda implementa a\float@addtolist
interface obsoleta.
Carregue o pacote scrhack
conforme sugerido nos avisos
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}% <- added
\usepackage{calc}
\usepackage{graphicx}
\usepackage{listings}
\setkomafont{chapter}{\Large}
\RedeclareSectionCommand[
beforeskip=\dimexpr-\topskip+2pt\relax,
afterindent=false
]{chapter}
\makeatletter
\renewcommand\chapterlinesformat[3]{%
\@hangfrom{#2}{\MakeUppercase{#3}}%
}
\makeatother
\begin{document}
\listoffigures
\listoftables
\lstlistoflistings
\chapter{A Chapter}
\begin{figure}
\centering\includegraphics[width=0.5\linewidth]{example-image}
\caption{First figure}
\end{figure}
\begin{table}
\caption{First table}
\centering
\begin{tabular}[width=0.5\linewidth]{ccc}
Cell 1 & Cell 2 & Cell 3
\end{tabular}
\end{table}
\begin{lstlisting}[caption={First listing}]
Some code
\end{lstlisting}
\end{document}