用點填滿目錄中的部分條目(使用 scrartcl)

用點填滿目錄中的部分條目(使用 scrartcl)

我使用scrartcl並且我想要…

  1. 目錄中列出了圖表列表和表格列表
  2. 在目錄中用點填滿各部分及其頁碼之間的空間
  3. 保留目錄的其餘部分不變。

這就是所需的輸出,使用tocstyle(下面的程式碼)產生:

\documentclass[listof=totoc]{scrartcl}

% Problem: alpha version and warning.
\usepackage{tocstyle}
\newtocstyle[KOMAlike][leaders]{alldotted}{}
\usetocstyle{alldotted}

\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

問題:如何在不使用 的情況下獲得相同的輸出tocstyle?我想避免,tocstyle因為它總是產生一個警告,表明該包是 alpha 版本,將來可能會發生變化。

我更喜歡一個盡可能小的解決方案,避免額外的包,手動將 LOF 和 LOT 添加到 TOC 等。

我已經嘗試使用tocloft它來代替,但後來其他事情出現了問題: <code>tocloft</code> 的結果

\documentclass[listof=totoc]{scrartcl}

% Problem: LOF and LOT not in TOC; different font style for sections.
\usepackage{tocloft}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}

\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

答案1

使用選項toc=sectionentrywithdots.儘管手冊上說這是測試版功能,但不會產生任何警告。

\documentclass[listof=totoc,toc=sectionentrywithdots]{scrartcl}  


\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

在此輸入影像描述

相關內容