
我的目錄有問題(本地和全局...)
我想在我的主目錄中包含一個未出現在前一章的 minitoc 中的章節行。另外,我希望這一行與主目錄中前一章的部分至少有一個空白行分隔開。
我嘗試製作一個最小的工作範例,在其中您將看到“Figures”行已新增到第 2 章的 minitoc 中,並且似乎屬於主目錄中的第 2 章。
\documentclass[a4paper, 12pt, twoside]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
\setcounter{minitocdepth}{2}
\begin{document}
\dominitoc
\tableofcontents
\chapter{The important things}
\minitoc
\section{foo}
\section{bar}
\chapter{Minor stuff}
\minitoc
\section{foo}
\section{bar}
\listoffigures
\addcontentsline{toc}{section}{Figures}
\end{document}
答案1
透過說\addcontentsline{toc}{section}{Figures}
,OP正在向現有章節(即第2章)添加“圖形”部分。章節,而不是節,這是用完成的\addcontentsline{toc}{chapter}{Figures}
。
這是 MWE:
\documentclass[a4paper, 12pt, twoside]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
\setcounter{minitocdepth}{2}
\begin{document}
\dominitoc
\tableofcontents
\chapter{The important things}
\minitoc
\section{foo}
\section{bar}
\chapter{Minor stuff}
\minitoc
\section{foo}
\section{bar}
\listoffigures
\addcontentsline{toc}{chapter}{Figures}
\end{document}
當然,這會將「數字」以章節的形式放置在目錄中:
人們可以手動強制它看起來像一個具有以下內容的部分:
\documentclass[a4paper, 12pt, twoside]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
\setcounter{minitocdepth}{2}
\makeatletter
\newcommand \Dotfill {\leavevmode \cleaders \hb@xt@ .79em{\hss .\hss }\hfill \kern \z@}
\makeatother
\begin{document}
\dominitoc
\tableofcontents
\chapter{The important things}
\minitoc
\section{foo}
\section{bar}
\chapter{Minor stuff}
\minitoc
\section{foo}
\section{bar}
\listoffigures
% \addcontentsline{toc}{chapter}{Figures}
\addcontentsline{toc}{chapter}{\mdseries\hspace{1.5em}Figures\Dotfill}
\end{document}
對於\Dotfill
,我採用了答案如何變更 \dotfill 中的點間距?