提问于:
浏览数:
1418
## 编译环境
操作系统
* [x]Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
*[x]TexLive `年份`
* [ ] MikTeX `版本号`
* [ ] CTeX
`若需勾选,请把[ ]改成[x]`
## 我的问题
目录生成异常,过多项目不断页,过少项目一页内间距过宽
```
\documentclass[UTF8,x11names,12pt,openright]{ctexbook}
\usepackage[dvipsnames,svgnames,table,xcdraw ]{xcolor}
\usepackage{ctex}
\usepackage[explicit]{titlesec}
\usepackage[colorlinks,
linkcolor=black,
anchorcolor=black,
citecolor=black
]{hyperref}
\titleformat{\chapter}
{\Huge\centering\bfseries\color{myTitleColor2}}{第\,\thechapter\,章}{1em}{\hyperlink{chap-\thechapter}{\color{myTitleColor2} #1}
\addtocontents{toc}{\protect\hypertarget{chap-\thechapter}{}}}
\titleformat{name=\chapter,numberless}
{\normalfont\Huge\centering\bfseries\color{myTitleColor2}}{}{0pt}{#1}
\definecolor{myTitleColor1}{RGB}{153,255,255}
\definecolor{myTitleColor2}{RGB}{59,227,218}
\titleformat{\section}
{\normalfont\Large\bfseries\color{myTitleColor2}}{考点\,\arabic{section}}{1em}{\hyperlink{sec-\thesection}{\color{myTitleColor2}#1}
\addtocontents{toc}{\protect\hypertarget{sec-\thesection}{}}}
\titleformat{name=\section,numberless}
{\normalfont\Large\bfseries\color{myTitleColor2}}{}{0pt}{#1}
\titleformat{\subsection}
{\normalfont\Large\bfseries\color{myTitleColor2}}{(\,\chinese{subsection})}{0.5em}{\hyperlink{subsec-\thesubsection}{\color{myTitleColor2}#1}
\addtocontents{toc}{\protect\hypertarget{subsec-\thesubsection}{}}}
\titleformat{name=\subsection,numberless}
{\normalfont\Large\bfseries\color{myTitleColor2}}{}{0pt}{#1}
\begin{document}
\tableofcontents%生成目录
\chapter{早}
\section{1}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\subsection{2}
\chapter{早}
\section{3}
\subsection{2}
\subsection{2}
\end{document}
```