我有如下目录:
\documentclass{report}
\begin{document}
\tableofcontents
\clearpage
\chapter{TEST}
\section{Introduction}
\section{Test section one}
\subsection{Test subsection}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\subsection{Test subsection}
\end{document}
我想在目录列表中显示“第 1 章:测试”语句,而不是“1 测试”。您能帮忙吗?
答案1
采用该包的解决方案tocloft
:
\usepackage[titles]{tocloft}
\renewcommand\cftchappresnum{Chapter }
\renewcommand\cftchapaftersnum{:}
\newlength\mylen
\settowidth\mylen{\bfseries Chapter 1:\ } % if more than 9 chapters, use "Chapter 10"
\cftsetindents{chap}{0pt}{\mylen}
完整的 MWE:
\documentclass{report}
\usepackage[titles]{tocloft}
\renewcommand\cftchappresnum{Chapter }
\renewcommand\cftchapaftersnum{:}
\newlength\mylen
\settowidth\mylen{\bfseries Chapter 1:\ }
\cftsetindents{chap}{0pt}{\mylen}
\begin{document}
\tableofcontents
\chapter{TEST}
\section{Introduction}
\section{Test section one}
\subsection{Test subsection}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\subsection{Test subsection}
\end{document}
答案2
方法如下:
\documentclass{report}
%%%%%ADDED CODE%%%%%
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>
%%%%%%END OF ADDED CODE%%%%%
\begin{document}
\tableofcontents
\clearpage
\chapter{TEST}
\section{Introduction}
\section{Test section one}
\subsection{Test subsection}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\subsection{Test subsection}
\end{document}
来源:https://tex.stackexchange.com/a/171061/120578
输出: