李清:基本的想法是把小节的目录标题整个放进一个 \hbox 里,然后在小节标题的段落里设置 \raggedright,允许右边对不齐,以消除坏盒子警告。可以通过 etoc 包来完成这一设置。
% !TeX program = XeLaTeX
% !TeX encoding = UTF-8
\documentclass{ctexbook}
\usepackage{etoc}
\newcommand*\cdotfill{%
\leavevmode
\leaders \hbox to .5em {\hss\textcdot\hss}\hfill}
\etocsetstyle{chapter}
{%
\setlength\rightskip{4\ccwd}%
\addtolength\parfillskip{-\rightskip}%
\etocskipfirstprefix
}
{\medskip}
{%
\bfseries
\noindent
\etocifnumbered
{%
\sbox0{\etocthenumber\unskip\quad}%
\setlength\leftskip{\wd0}%
\etoclink{\llap{\box0}\etocthename}%
}
{%
\setlength\leftskip{\rightskip}%
\hskip-\leftskip
\etocname
}%
\nobreak\cdotfill\etocpage\par
}
{}
\etocsetstyle{section}
{\nopagebreak\normalfont}
{\smallskip}
{%
\noindent
\etocifnumbered
{\etoclink{\llap{\etocthenumber\quad}\etocthename}}
{\etocname}%
\nobreak\cdotfill\etocpage\par
}
{}
\etocsetstyle{subsection}
{%
\nopagebreak
\begingroup
\addtolength\parfillskip{\rightskip}%
\addtolength\rightskip{\fill}%
\etocskipfirstprefix
\noindent
}
{\quad}
{%
\hbox{%
\etoclink{%
\etocifnumbered{\etocthenumber\enskip}{}%
\etocthename\ (\etocthepage)%
}%
}%
}
{\par\endgroup}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{微分学的基本定理}
\section{微分学基本定理}
\subsection{基本定理}
\subsection{导函数的两个定理}
\subsection{例题}
\subsection{练习题}
\section{Taylor 定理}
\subsection{基本定理}
\subsection{例题}
\subsection{Euler 数和 Bernoulli 数}
\subsection{练习题}
\section{对于教学的建议}
\subsection{学习要点}
\subsection{参考题}
\ctexset{subsection/numbering=false}
\subsection{第一组参考题}
\subsection{第二组参考题}
\ctexset{subsection/numbering}
\addtocounter{chapter}{20}
\chapter{微分学的基本定理}
\section{微分学基本定理}
\subsection{基本定理}
\subsection{导函数的两个定理}
\subsection{例题}
\subsection{练习题}
\section{Taylor 定理}
\subsection{基本定理}
\subsection{例题}
\subsection{Euler 数和 Bernoulli 数}
\subsection{练习题}
\section{对于教学的建议}
\subsection{学习要点}
\subsection{参考题}
\ctexset{subsection/numbering=false}
\subsection{第一组参考题}
\subsection{第二组参考题}
\ctexset{subsection/numbering}
\end{document}效果图:
这里扩展阅读,我们翻译的titlesec的目录样式也是类似的样式,有兴趣的用户可以看看titlesec的说明文档代码,这里提供下汉译版本的titlesec的pdf文件。
下载区
本站下载:titlesec_c



发表评论 取消回复