
我想創建一個如下所示的內容:
A chapter page
1 section page
1.1 subsection1 page
subsubsection1 - subsubsection2
subsubsection3 - subsubsection4
1.2 subsection2 page
subsubsection1 - subsubsection2
子小節應該是未編號的,並顯示在包含後續行的清單中,並且應該用連字號分隔。
我成功地對章節進行了編號,但我不知道如何實現小節樣式。有任何想法嗎?對於我使用的章節和部分
\renewcommand\thechapter{\Alph{chapter}}
\renewcommand{\thesection}{\arabic{section}}
謝謝您的協助
答案1
您可以使用titletoc
為此的包:
代碼:
\documentclass{book}
\usepackage{titletoc}
\renewcommand\thechapter{\Alph{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\titlecontents*{subsubsection}
[7em]
{\small}
{\thecontentslabel}
{}
{}
[~---\ ]
\setcounter{tocdepth}{3}
\begin{document}
\tableofcontents
\chapter{A test chapter}
\section{A test section}
\subsection{A test subsection}
\subsubsection{Test subsubsection one one}
\subsubsection{Test subsubsection one two}
\subsubsection{Test subsubsection one three}
\subsubsection{Test subsubsection one four}
\subsection{Another test subsection}
\subsubsection{Test subsubsection two one}
\subsubsection{Test subsubsection two two}
\subsubsection{Test subsubsection two three}
\subsubsection{Test subsubsection two four}
\subsubsection{Test subsubsection two five}
\subsection{Yet another test subsection}
\subsubsection{Test subsubsection three one}
\end{document}
更新
在評論中,要求在標題後面添加頁碼;這是一種方法;我在標題和頁碼之間添加了一個逗號和一個牢不可破的空格(根據需要調整):
\documentclass{book}
\usepackage{titletoc}
\renewcommand\thechapter{\Alph{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\titlecontents*{subsubsection}
[7em]
{\small}
{\thecontentslabel}
{}
{,~\thecontentspage}
[~---\ ]
\setcounter{tocdepth}{3}
\begin{document}
\tableofcontents
\chapter{A test chapter}
\section{A test section}
\subsection{A test subsection}
\subsubsection{Test subsubsection one one}
\subsubsection{Test subsubsection one two}
\subsubsection{Test subsubsection one three}
\subsubsection{Test subsubsection one four}
\subsection{Another test subsection}
\subsubsection{Test subsubsection two one}
\subsubsection{Test subsubsection two two}
\subsubsection{Test subsubsection two three}
\subsubsection{Test subsubsection two four}
\subsubsection{Test subsubsection two five}
\subsection{Yet another test subsection}
\subsubsection{Test subsubsection three one}
\end{document}