tocbibind 套件無法將 TOC 新增至目錄,可能與 minitoc 衝突

tocbibind 套件無法將 TOC 新增至目錄,可能與 minitoc 衝突

我的論文有以下 LaTeX 程式碼:

\documentclass[12pt,a4paper,oneside]{book}

\usepackage{verbatim}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr,multirow}
\usepackage{setspace}
\usepackage{tocbibind}
\usepackage{etoc}
\usepackage{ifthen}

\newlength\tocrulewidth
\setlength{\tocrulewidth}{1.5pt}

\begin{document}
    \frontmatter
        \input{TitlePage.tex}
        \input{Declaration.tex}
        \input{Certificate.tex}
        \input{Dedication.tex}
        \input{Abstract.tex}
        \input{Acknowledgements.tex}        
        \tableofcontents        
        \listoftables
        \listoffigures
        \input{Publications.tex}

    \mainmatter
        \input{Chapter1/Chapter1.tex}
\end{document}

我在每章的開頭都包含了一個迷你目錄。也許這就是為什麼我沒有在目錄中獲得“目錄”條目。我得到以下資訊:

在此輸入影像描述

對於 minitoc,我在每一章都有以下程式碼:

\chapter{Introduction}
    \begingroup
        \parindent=0em
        \etocsettocstyle{\rule{\linewidth}{\tocrulewidth}\vskip0.5\baselineskip}{\rule{\linewidth}{\tocrulewidth}}
        \localtableofcontents 
    \endgroup

    % Text of the chapter goes here...

但我想在「致謝」和「表格清單」之間有一個未編號的「內容」條目。我怎樣才能做到這一點?任何幫助,將不勝感激。

答案1

第一種方式:您可以嘗試手動新增:

\documentclass[12pt,a4paper,oneside]{book}

\usepackage{verbatim}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr,multirow}
\usepackage{setspace}
%\usepackage{tocbibind} Not needed now
\usepackage{etoc}
\usepackage{ifthen}
\newlength\tocrulewidth
\setlength{\tocrulewidth}{1.5pt}





\begin{document}

    \frontmatter
    \chapter{Declaration}
    \chapter{Certificate}
        \tableofcontents\addcontentsline{toc}{chapter}{Contents}
        \listoftables
        \listoffigures


    \mainmatter
        \chapter{test}
\end{document}

結果:

在此輸入影像描述

第二種方式:您也可以使用 etoc 來添加它:

\documentclass[12pt,a4paper,oneside]{book}

\usepackage{verbatim}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr,multirow}
\usepackage{setspace}
%\usepackage{tocbibind} Not need it!
\usepackage{etoc}
\usepackage{ifthen}
\newlength\tocrulewidth
\setlength{\tocrulewidth}{1.5pt}





\begin{document}

    \frontmatter
    \chapter{Declaration}
    \chapter{Certificate}
        \tableofcontents\etoctoccontentsline{chapter}{Contents}
        \listoftables
        \listoffigures


    \mainmatter
        \chapter{test}
        \begingroup
        \parindent=0em
        \etocsettocstyle{\rule{\linewidth}{\tocrulewidth}\vskip0.5\baselineskip}{\rule{\linewidth}{\tocrulewidth}}
        \localtableofcontents 
        \endgroup
        \section{test section}
\end{document}

結果是一樣的。

我想 tocbibind 不能與 etoc 一起使用。

相關內容