
질문을 바탕으로KOMA 스크립트 목록 목록과 LOF의 제목 아래 공간이 동일하지 않습니다.나는 TOC를 사용하여 예제를 확장했습니다. 내 문서에서 etoc 패키지를 사용하고 KOMA 옵션이 parskip=half
TOC 장 제목과 TOC 항목 사이의 세로 간격을 변경합니다. LOF, LOF...의 간격은 동일하게 유지됩니다. 이러한 비호환성을 방지하는 방법은 무엇입니까? 이미지는 문제를 설명해야 합니다. 미리 감사드립니다!
편집: xelatex로 컴파일합니다.
MWE:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{etoc}
\onehalfspacing
\KOMAoptions{parskip=half}
\begin{document}
\tableofcontents
\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
(lof, lot, lol) 의 제어를 받는 목록에서는 단락 간격이 꺼지기 전에 tocbasic
끝이 삽입됩니다. \parskip
이 삽입은 다음에 의해 비활성화될 수 있습니다.
\doforeachtocfile{\setuptoc{#1}{noparskipfake}}
그러나 그러면 일반 장 제목과 일반 텍스트 사이보다 목록 제목과 첫 번째 항목 사이의 수직 공간이 더 적습니다.
\parskip
따라서 의 제어를 받는 목차(toc)에서 단락 간격이 꺼지기 전에 이 최종 항목을 추가하는 것이 더 나을 것입니다 etoc
. 에서는 \etocscrbookstyle
이를 고려하지 않습니다 \parskip
. 하지만 패치를 통해 \etocscrbookstyle
이와 관련된 코드를 추가할 수 있습니다 \parskip
( 에서 복사 tocbasic
).
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\etocscrbookstyle}
{\setlength {\parskip }{\z@ }}
{%
\etoc@Iftocfeature{\@currext}{noparskipfake}{}{%
\ifvmode
\@tempskipa\lastskip
\vskip-\lastskip
\addtolength{\@tempskipa}{\parskip}%
\vskip\@tempskipa
\fi
}%
\setlength {\parskip }{\z@ }%
}{}{\PatchFailed}
\makeatother
\etocstandarddisplaystyle
예:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{etoc}
\onehalfspacing
\KOMAoptions{parskip=half}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\etocscrbookstyle}
{\setlength {\parskip }{\z@ }}
{%
\etoc@Iftocfeature{\@currext}{noparskipfake}{}{%
\ifvmode
\@tempskipa\lastskip
\vskip-\lastskip
\addtolength{\@tempskipa}{\parskip}%
\vskip\@tempskipa
\fi
}%
\setlength {\parskip }{\z@ }%
}{}{\PatchFailed}
\makeatother
\etocstandarddisplaystyle
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\lstlistoflistings
\chapter{A Chapter}
Some text
\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}