使用ctexart文档类和titletoc宏包,导致目录只显示在一页

发布于 2021-06-01 01:36:43

使用ctexart文档类和titletoc宏包时,目录条数多了,就都只显示在一页上。
8d30dc54160e1e7763814690d151c5d7.png

MWE如下:

\documentclass{ctexart}
\RequirePackage{titletoc}
\titlecontents{part}[0em]{}{\contentslabel{1em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{section}[1em]{}{\contentslabel{1em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{subsection}[3em]{}{\contentslabel{2em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{subsubsection}[5em]{}{\contentslabel{3em}}{}{\titlerule*{$\cdot$}\contentspage}
\begin{document}
    \part{A}
    \section{1}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{2}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{3}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \part{B}
    \section{1}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{2}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{3}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \part{C}
    \section{1}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{2}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \section{3}
    \subsection{1}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{2}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
    \subsection{3}
    \subsubsection{1}
    \subsubsection{2}
    \subsubsection{3}
\end{document}

查看更多

关注者
0
被浏览
2k
1 个回答
尘
2021-06-01
这家伙很懒,什么也没写!

首先,这个不是目录是正文,需要打印目录的话,在正文前添加命令 tableofcontens
其次,正文文本不分页是因为 LaTeX 的章节命令的原因,在 subsubsection{} 后添加文字就能正常分页了

\documentclass{ctexart}
\usepackage{titletoc}
\usepackage{zhlipsum}



\titlecontents{part}[0em]{}{\contentslabel{1em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{section}[1em]{}{\contentslabel{1em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{subsection}[3em]{}{\contentslabel{2em}}{}{\titlerule*{$\cdot$}\contentspage}
\titlecontents{subsubsection}[5em]{}{\contentslabel{3em}}{}{\titlerule*{$\cdot$}\contentspage}
\begin{document}
\tableofcontents

    \part{A}
    \section{1}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \section{2}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    
    \section{3}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \part{B}
    \section{1}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \section{2}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \section{3}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \part{C}
    \section{1}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \section{2}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \section{3}
    \subsection{1}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{2}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
    \subsection{3}
 \subsubsection{1} \zhlipsum
 \subsubsection{2} \zhlipsum
 \subsubsection{3} \zhlipsum
\end{document}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览