minitoc 没有出现

minitoc 没有出现

这是我正在尝试做的一个小例子:

\documentclass[a4paper]{report}

\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{float}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{url}
\usepackage[colorlinks]{hyperref}
\usepackage{array}
\usepackage{tabularx}
\usepackage{setspace}
\usepackage{abstract}
\usepackage[T1]{fontenc}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{subfig}
\usepackage{minitoc}
\graphicspath{ {figures/} }
\usepackage{etoolbox}
\usepackage
 [
   acronyms,
   nohypertypes={acronym},
   shortcuts,
   nonumberlist,
   nogroupskip,
   nopostdot
 ]{glossaries}
\newif\ifshowacrlink
\newacronymstyle{long-short-hyperlinkperpage}
{%
  \ifglsused{\glslabel}%
  {%
    \ifcsdef{ac@curpg@\glslabel}%
    {%
      \edef\thispage{\thepage}%
      \ifcsequal{ac@curpg@\glslabel}{thispage}%
      {% on the same page
        \showacrlinkfalse
      }%
      {% now on a new page
        \showacrlinktrue
        \csedef{ac@curpg@\glslabel}{\thepage}%
      }%
    }%
    {%
      \csedef{ac@curpg@\glslabel}{\thepage}%
      \showacrlinktrue
    }%
  }%
  {%
    % don't hyperlink on first use:
    \showacrlinkfalse
  }%
  \ifshowacrlink
    \glshyperlink[\glsgenacfmt]{\glslabel}%
  \else
    \glsgenacfmt
  \fi
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
}%
\setacronymstyle{long-short-hyperlinkperpage}
\makenoidxglossaries
\newacronym{st}{ST}{Something}



\setcounter{secnumdepth}{4} % paragraphs
\setcounter{tocdepth}{4}

\begin{document}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\thispagestyle{empty}
\newpage

\pagenumbering{roman}
\setcounter{secnumdepth}{-1}
\input{./sections/abstract.tex}
\input{./sections/acknowledgements.tex}

\setcounter{secnumdepth}{6}
\dominitoc
\tableofcontents

\clearpage
\listoffigures \addcontentsline{toc}{chapter}{List of Figures} \mtcaddchapter 
\listoftables \addcontentsline{toc}{chapter}{List of Tables} \mtcaddchapter 
\printnoidxglossary
[type=acronym,
sort=def,
title = List of Acronyms]

\renewcommand{\arraystretch}{1.5} 
~
\thispagestyle{empty}

\setcounter{page}{0}
\newpage

\pagenumbering{arabic}
\chapter{Introduction}
\minitoc[1]
\section{Content}
\lipsum
blablabla \ac{st}
blablabla \ac{st}

\section{Objectives}
\section{Contributions}
\section{Publications}

\end{document}

我不知道为什么 minitoc 没有出现在章节开头。我尝试添加\mtcaddchapter\listoffigures \listoftablesminitoc 没有出现?

但它不起作用。

编辑 (以防有人遇到同样的问题)

根据@SimonDispa 的回答,我对摘要和致谢部分进行了如下更改:

\renewcommand{\abstractnamefont}{\normalfont\Large\bfseries}
\begin{abstract}
\hskip7mm
\begin{spacing}{1.3}
bla bla bla bla
\end{spacing}
\end{abstract}

\chaper*{acknowledgments}

答案1

etoc使用包而不是可以节省大量编译时间minitoc。它使用文件.aux,因此在完成主目录时会显示部分目录中的所有更改。

(并且它不会使您的目录与所有.mt文件混杂在一起)

添加\etocsettocstyle{<code before>}{<code after>}\minitoc替换\localtableofcontents

X

是

尝试此代码。查看如何 \chapter*{Acknowledgements}将其添加到目录中。

\documentclass[a4paper]{report}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{abstract}
\usepackage{lipsum}

\usepackage{etoc} % added <<<<<<<<<<<<
\etocsetnexttocdepth{subsection} %list subsections

\begin{document}

    \pagenumbering{roman}
    
    \renewcommand{\abstractnamefont}{\normalfont\Large\bfseries}
        \begin{abstract}
        \bigskip
        \begin{spacing}{1.3}
            \lipsum[1]
        \end{spacing}
    \end{abstract}
    
    \chapter*{Acknowledgements}\addcontentsline{toc}{chapter}{Acknowledgements} 
    \lipsum[2]
    \newpage
    
    \setcounter{secnumdepth}{6}
    \tableofcontents    
    
    \clearpage
    \listoffigures \addcontentsline{toc}{chapter}{List of Figures} 
    \listoftables \addcontentsline{toc}{chapter}{List of Tables} 
    
    
    \etocsettocstyle{\vskip-2\baselineskip\noindent\rule{\linewidth}{0.5pt}\vskip0.3\baselineskip}%
    {\noindent\rule{\linewidth}{0.5pt}\vskip0.5\baselineskip} % etoc style for local TOC <<<<<<<<<<<<<
    
    \newpage
    \setcounter{page}{0}
    \pagenumbering{arabic}
    
    \chapter{Introduction}
    \localtableofcontents % local TOC <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
    
    \section{Objectives}    
    \lipsum[1-8]    
    \section{Contributions}
    \subsection{Local}
    \subsection{Others}         
    \section{Publications}

\end{document}

相关内容