titletoc
由于不建议将 和 结合使用KOMA-Script
,我正在寻找一种解决方案,允许以下目录布局专门用于 的小节KOMA-Script
。我首先尝试使用\DeclareTOCStyleEntry
和tocraggedpagenumber
,但我找不到一种方法来防止条目后换行 - 如果它可以使用 的\DeclareTOCStyleEntry
话。以下最小示例显示了我当前使用 的尝试titletoc
:
\documentclass{scrbook}
\usepackage{lmodern}
\usepackage{titletoc}
\titlecontents*{subsection}
[3.8em]
{\small\itshape}
{\thecontentslabel\ }
{}
{\ \thecontentspage}
[\ $\cdot$\ ]
[]
\begin{document}
\tableofcontents
\chapter{Testchapter}
\section{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\end{document}
答案1
从 KOMA-Script 3.27.3167 版本开始,现在可以使用新的 tocstyle 实现上述目录布局toctext
(参见来自@esdd 的评论)这是一个新的工作MWE(感谢Markus Kohm):
\documentclass{scrbook}
\usepackage{lmodern}
\DeclareTOCStyleEntry[%
raggedright=false,% don't activate ragged right
entryformat=\textit,% The format expects the text as argument, so we prefer
% \textit over \itshape
pagenumberformat={},% don't use default \normalfont for the page numbers
onstartfirstentry=\small,% Use \small for the whole paragraph
onstartentry={\ $\cdot$\ },% distance and centered dot between entries
onendentry={},% do not use the default \quad after entries,
afterpar=\normalsize,% after final par switch back to \normalsize (note:
% will be executed for each entry!)
]{toctext}{subsection}
\begin{document}
\tableofcontents
\chapter{Testchapter}
\section{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\subsection{Testsection}
\end{document}