如何创建这种目录?

如何创建这种目录?

有章节、节和小节。小节没有编号。我希望目录看起来像这样,也就是说,将所有小节压缩为一行或多行:

目录中的子部分位于一行中,带有分隔符且没有数字

我该怎么做呢?基本上,我使用 KOMA-Script —— 如果这有助于回答这个问题的话。我在 Word 中创建了这个模型。

答案1

以下方法有点儿不方便,目前确实存在局限性。我正在尝试在将来修复这些问题。下图中可以看到一些局限性。但我认为 ToC 非常接近您的方法。

\documentclass[numbers=enddot]{scrreprt}

\newif\ifadditionalssec
%\setcounter{secnumdepth}{1} % not necessary anymore


\AtEndDocument{\addtocontents{toc}{\par}}

\newdimen\ssectocindent\ssectocindent=1.5cm
\makeatletter
\RedeclareSectionCommand[%
    toclinefill=\section@dotfill,%
    toconstartlowerlevel={\afterssecs},%
    tocpagenumberbox=\hbox]
    {section}
\RedeclareSectionCommand[%
    toclinefill=\chapter@dotfill,%
    toconstartlowerlevel={\afterssecs},%
    tocpagenumberbox=\hbox]
    {chapter}
\newcommand*{\chapter@dotfill}{%
    \def\@dotsep{0.072}\TOCLineLeaderFill[\textbf{.}]}
\newcommand*{\section@dotfill}{%
    \def\@dotsep{0.072}\TOCLineLeaderFill}
\def\afterssecs{%
    \def\numberline##1{\scr@numberline{##1}}\par\additionalssecfalse}
\def\l@subsection#1#2{%
    \def\numberline##1{}%
    \ifadditionalssec%
        $\cdot$ % this is the delimiting dot, change it to your liking
    \else%
        \par%
        \hangindent\ssectocindent%
        \parindent\ssectocindent%
        \rightskip\ssectocindent%
        \global\additionalssectrue%
    \fi#1}
\makeatother

\begin{document}
\tableofcontents

\chapter{Foo}
\section{Bar}
\subsection{Baz}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}

\chapter{Foo}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}

\end{document}

在此处输入图片描述

相关内容