在报告类中将 tocdepth 设置为零会使 minilot 和 minilof 不显示

在报告类中将 tocdepth 设置为零会使 minilot 和 minilof 不显示

我希望我的主要目录仅显示章节。而不是节和小节。这是report类。所以我添加了\setcounter{tocdepth}{0}它。但后来我注意到一些奇怪的事情。minilof现在minilot我的章节中都是空的。但minitoc不是空的。

如何让主目录仅显示章节,但每章中仍有一个minilot和?这是一个 MWEminilof

\documentclass[12pt]{report}%   
\usepackage{minitoc}  
\begin{document}
\dominitoc  %initialize
\dominilof
\dominilot
\setcounter{tocdepth}{0} %For the main TOC, only show chapter, but this
     %makes minilot not to show up ! change to 1 to have minilot show up!
\tableofcontents
\listoffigures
\listoftables        
ok....    
\chapter{chapter test}
\minitoc  %this show OK
\minilof  %this is empty
\minilot

here we go, one table, to see if it will show up in minilot

\begin{table}[!htbp]
\centering
\caption{my table}
\begin{tabular}{|c|}\hline
nice table\\\hline
\end{tabular}
\end{table}
\section{section below the chapter}
some section
\end{document}

使用 pdflatex 进行编译,显示如下:

Mathematica 图形

更改\setcounter{tocdepth}{0}\setcounter{tocdepth}{1}现在显示:

Mathematica 图形

问题是:如何使主目录仅显示章节,但仍能使用minilotminilof。请注意,没有问题minitoc

使用 TL 2015

 *File List*
  report.cls    2014/09/29 v1.4h Standard LaTeX document class
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 minitoc.sty    2015/07/13 v61 Package minitoc
 mtcmess.sty    2006/03/14
     foo.mtc0
 english.mld    2006/01/13
 english.mld    2006/01/13

答案1

这就是所指的吗?写入\setcounter{tocdepth}{0}文件.toc,然后使用and中的某些默认值level(例如3)恢复此文件——这假设使用或.lof.lot\listoffigures\listoftables \tableofcontents

\documentclass[12pt]{report}%   
\usepackage{minitoc}  
\def\mytocdepth{3}
\begin{document}
\dominitoc  %initialize
\dominilof
\dominilot
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
\addtocontents{lot}{\protect\setcounter{tocdepth}{\mytocdepth}}
\addtocontents{lof}{\protect\setcounter{tocdepth}{\mytocdepth}}
%\setcounter{minitocdepth}{\mytocdepth} %For the main TOC, only show chapter, but this
     %makes minilot not to show up ! change to 1 to have minilot show up!
\tableofcontents
\listoffigures
\listoftables        
ok....    
\chapter{chapter test}
\minitoc  %this show OK
\minilof  %this is empty
\minilot

here we go, one table, to see if it will show up in minilot

\begin{table}[!htbp]
\centering
\caption{my table}
\begin{tabular}{|c|}\hline
nice table\\\hline
\end{tabular}
\end{table}

\begin{figure}[!htbp]
\centering
\caption{my figure}
\end{figure}

\section{section below the chapter}
some section
\end{document}

相关内容