
如何從兩個迷你目錄中刪除“無論它是什麼”? (我希望它保留在主目錄中。)
\documentclass[notoc]{tufte-book}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}
\tableofcontents
\chapter{Introduction}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\section{Historical Overview}
\section{The CUDA Model}
\section{A Lattice Boltzmann Solver}
\stopcontents[chapters]% doesn't work
\addtocontents{toc}{Whatever it is\endgraf}
\resumecontents[chapters]% doesn't work
\chapter{Foo Bar}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\section{My Overview}
In this chapter we first...
\end{document}
答案1
最好將目錄中的「隨機文字」關聯為某種形式的分段單元。就像你有chapter
,,section
...,讓我們稱之為special
:
\documentclass[notoc]{tufte-book}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\makeatletter
\newcommand{\l@special}[2]{#1\endgraf}
\makeatother
\begin{document}
\tableofcontents
\chapter{Introduction}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\section{Historical Overview}
\section{The CUDA Model}
\section{A Lattice Boltzmann Solver}
\stopcontents[chapters]
\addcontentsline{toc}{special}{Whatever it is}
\resumecontents[chapters]
\chapter{Foo Bar}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\section{My Overview}
In this chapter we first...
\end{document}
我們定義\l@special
處理目錄中的特殊條目...在這種情況下,只需編寫它包含的任何內容即可。