我想在一个文档中有两个目录,所以我使用了这个包etoc
,并且我有两个相同内容的目录,我想要像这样
\documentclass{book}
\usepackage{etoc}
\begin{document}
\tableofcontents % the first
\chapter{chapitre 1}% I want just this chapter in the first table of contents
\section{hello}
\tableofcontents
\chapter{chapitre2} % I want just this chapter in the second table of contents
\section{HELLO}
\end{document}
请帮忙
答案1
以下是使用该包的方法etoc
:
\documentclass{book}
\usepackage{etoc}
\begin{document}
\etocsettocstyle{\chapter*{First TOC (just chapter 1)}}{}
\tableofcontents \ref{toc:chapter 1}% the first
\chapter{chapitre 1}% I want just this chapter in the first table of contents
\invisiblelocaltableofcontents \label{toc:chapter 1}
\section{hello}
\etocsettocstyle{\chapter*{Second TOC (just chapter 2)}}{}
\tableofcontents \ref{toc:chapter 2}% the first
\chapter{chapitre2} % I want just this chapter in the second table of contents
\invisiblelocaltableofcontents \label{toc:chapter 2}
\section{HELLO}
\end{document}
答案2
我用了这个代码
\documentclass{book}
\usepackage{titletoc}
\begin{document}
\startcontents
\printcontents{}{-1}{\chapter*{Table des matière}}
\chapter{Chapitre 1}
\section{hello}
\stopcontents
\startcontents
\printcontents{}{-1}{\chapter*{Table des matière}}
\chapter{Chapitre 2}
\section{Hello}
\stopcontents
\end{document}