我已经实现了下面的代码。
\documentclass[12pt]{book}
\usepackage{etoc}
\begin{document}
\chapter{First Chapter}
\renewcommand{\contentsname}{}
\setcounter{tocdepth}{2}
\etocsettocstyle{\subsection*{\contentsname}\hrule\smallskip
\begin{minipage}{\linewidth}}
{\end{minipage}\medskip\hrule}
\localtableofcontents
\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 2}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 3}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 4}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 5}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 6}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 7}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 8}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\end{document}
基本上,它会生成从第二页而不是第一页开始的 etoc。
我如何确保它从第一页开始并继续到第二页?
答案1
为什么把它放在里面minipage
?
我认为
\etocsettocstyle{\bigskip\hrule\medskip}{\medskip\hrule\vfill}
应该做你想做的事,而无需重新定义的含义\contentsname
。
平均能量损失
\documentclass[12pt]{book}
\usepackage{etoc}
\begin{document}
\chapter{First Chapter}
\setcounter{tocdepth}{2}
\etocsettocstyle{\bigskip\hrule\medskip}{\medskip\hrule\vfill}
\localtableofcontents
\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 2}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 3}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 4}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 5}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 6}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 7}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 8}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\end{document}
输出: