tikz
我怎样才能在目录中间放置某种分隔符(例如水平线或边缘),以将目录分成前言、正文和后记的不同块。
答案1
根据需要调整间距:
\documentclass{book}
\usepackage[nottoc]{tocbibind}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\addtocontents{toc}{\protect\addvspace{20pt}\hrule\protect\addvspace{10pt}}
\mainmatter
\chapter{Title}
\addtocontents{toc}{\protect\addvspace{20pt}\hrule\protect\addvspace{10pt}}
\backmatter
\chapter{\bibname}
\end{document}
当然你可以让它自动化,比如说
\documentclass{book}
\usepackage{etoolbox}
\usepackage[nottoc]{tocbibind}
\newcommand{\tocseparator}{%
\addtocontents{toc}
{\protect\addvspace{20pt}%
\hrule
\protect\addvspace{10pt}%
}%
}
\preto\mainmatter{\tocseparator}
\preto\backmatter{\tocseparator}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\mainmatter
\chapter{Title}
\backmatter
\chapter{\bibname}
\end{document}