
この非常に単純な mwe でこのエラーが発生するのはなぜでしょうか? クラス 2 つで同じエラーが発生するようですbook
。
\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}
\addtocontents{toc}{text}
\chapter{chap3}
\section{My Overview}
\end{document}
答え1
章の行の前に段落区切りを挿入する必要があります。\par を直接使用することは許可されていないため、\endgraf を使用します。
\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}
\addtocontents{toc}{text\endgraf}
\chapter{chap3}
\section{My Overview}
\end{document}
答え2
.toc
これは、ファイル内にランダムなテキストを導入することで発生します。
\addtocontents{toc}{text}
そうしたい場合は、\par
後で を発行してテキストが独立していることを確認してください。
次の最小限の例は問題を再現します。
\documentclass{article}
\begin{document}
\tableofcontents
\section{A section}
\addcontents{toc}{text}% Error
%\addtocontents{toc}{text\par}% No error
\section{Another section}
\end{document}