
나는 scrbook 클래스(xelatex)와 패키지의 목록 목록에서 예상치 못한 동작을 관찰했습니다 listings
. LOF의 장 제목과 목록 목록 사이의 간격과 각 목록의 첫 번째 항목 사이의 간격은 동일하지 않습니다. 목록 패키지는 MWE와 같은 장 제목의 모양을 사용자 정의하지 않고도 훨씬 더 큰 간격을 생성합니다. 문제가 무엇인지, 해결 방법을 아는 사람이 있습니까? 감사해요!
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}
답변1
코드 로그 파일에는 두 가지 경고가 있습니다.
수업 스크북 경고:
\float@listhead
감지되었습니다! 의 구현은\float@listhead
KOMA-Script v3.01 2008/11/14에서 더 이상 사용되지 않으며 package 의 보다 유연한 여러 기능으로 대체되었습니다tocbasic
. 아마도 구현이\float@listhead
곧 KOMA-Script에서 제거될 것입니다. 입력 라인 18에서scrhack
더 이상 사용되지 않는 인터페이스를 여전히 구현하는 패키지를 사용하는 경우 패키지를 로드하면 이 경고를 방지하는 데 도움이 될 수 있습니다.\float@listhead
그리고
수업 스크북 경고:
\float@addtolists
감지되었습니다! 의 구현은\float@addtolist
KOMA-Script v3.01 2008/11/14에서 더 이상 사용되지 않으며 package 의 보다 유연한 여러 기능으로 대체되었습니다tocbasic
. 더 이상 사용되지 않는 인터페이스에 대한 버전 3.12 지원은\float@addtolist
KOMA 스크립트 기능 중 일부로만 제한되었으며 다른 기능에서는 제거되었습니다.scrhack
더 이상 사용되지 않는 인터페이스를 구현하는 패키지를 사용하는 경우 패키지를 로드하면 이 경고를 방지하는 데 도움이 될 수 있습니다\float@addtolist
.
scrhack
경고에 제안된 대로 패키지를 로드합니다.
\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}