我怀疑下面链接的定制大学论文课程可能包含禁止执行基本minitoc
调用的内容。
可以.cls
找到这里
此 URL 提供的代码还包括用于使用 的 mwe .cls
。我很快就插入了命令:(\usepackage{minitoc}
放在通常的位置)、\dominitoc
(放在我认为\tableofcontents
将被调用的位置之前)和\minitoc
(放在\chapter{}
调用之后),如文档所建议的那样minitoc
。
我没有观察到 minitoc。我正在使用 PdfLaTeX 进行编译。
我认识到论文类旨在实现标准格式,这minitoc
可能是不需要的。我认为它的实现对于构建文档很有用,并且很容易禁用。
% simple.tex -- a very simple thesis document for demonstrating % dalthesis.cls class file \documentclass[12pt]{dalthesis}
\usepackage{minitoc}
\begin{document}
\title{The title} \author{Noah Body}
% The following degrees are included in the current dalthesis.cls % class file: \mcs % options are \mcs, \macs, \mec, \mhi, \phd, and \bcshon
% If you degree is not included, you can set several options manually. % The following example shows the parameters for the \mcs degree. % However, if you need to set these parameters manually, please check % the correct names with the Faculty of Graduate Studies, and let the % maintainer of this class file know (Vlado Keselj, [email protected]). % MCS Example:
\degree{Doctor of Mixology} %\degreeinitial{M.C.Sc.} \faculty{Science} \dept{Contemporary Home Economics}
% Month and Year of Defence \defencemonth{June}\defenceyear{2013}
\dedicate{Optionally, the thesis can be dedicated to someone, and the student can enter the dedication content here.}
% This sample thesis contains no tables nor figures, so there is no % need to include lists of tables and figures in the front matter: \nolistoftables \nolistoffigures
\dominitoc
\frontmatter
\begin{abstract} This is a test document. \end{abstract}
\begin{acknowledgements} Thanks to all the little people who make me look tall. \end{acknowledgements}
\mainmatter
\chapter{Introduction}
Get it done! Use reference material by Lamport~\cite{latex-by-lamport} or Gooses, Mittelback, and Samarin~\cite{latex-companion}.
\chapter{Doing It}
\minitoc
\section{Getting Ready}
Get all the parts that I need. I can throw in a whole pile of terms like preparation, methodology, forethought, and analysis as examples for me to use in the future.
\section{Next Step}
Do it!
Of course, you have to have pictures to show how you did it to make people understand things better.
\chapter{Conclusion}
Did it!
\bibliographystyle{plain} \bibliography{simple}
\end{document}
我注意到我确实看到了一个名为的文件,mwe.mtc4
其内容如下:
{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {2.1}Getting Ready}{\reset@font\mtcSfont 2}}
{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {2.2}Next Step}{\reset@font\mtcSfont 2}}
正在生成一系列这样的文件:mwe.mtc
,,,,,,,其中大多数文件大小为 0 KB,而只有内容。mwe.mtc0
令人鼓舞,但我不明白为什么 minitoc 没有出现在章节调用之后。mwe.mtc1
mwe.mtc2
mwe.mtc3
mwe.mtc4
mwe.mtc5
mwe.mtc4
答案1
免责声明:这很可能不是一个完整的解决方案。两者dalthesis
都minitoc
重新定义了很多与章节、各种列表的格式等相关的内部命令。我尝试修复您示例中至少最明显的问题。
dalthesis
和的主要问题minitoc
是 minitoc 编号不同步,因为两个文件都重新定义或修补\chapter
其内部宏。因此,第一步是正确地将所有修补的命令链接在一起。(minitoc
检测重新定义并发出警告,该警告也必须被抑制。)
由于根据文件中的条目minitoc
创建文件,因此当章节出现在目录中但没有编号时,编号仍然是错误的。然后,所有 minitoc 文件的读取过程都找不到正确的文件。这就是为什么您没有得到第 2 章的 minitoc,因为内容已写入文件。要调整带星号章节的编号,请提供一个命令,该命令将写入文件以发出信号,表示 minitoc 计数器应该减少。但是,当前的实现本身无法工作,因此也需要修复。.mtc*
\contentsline
.toc
.mtc4
minitoc
\chapterbegin
.toc
最后一步是,每当带星号的章节与目录条目一起出现时,\chapterbegin
将此标记写入文件。这发生在、和宏中。在后者中,写入必须分别转到和文件。.toc
dalthesis
\nonumchapter
\prefacesection
\frontmatter
.lot
.lof
应用所有补丁后,编号似乎可以正确与\chapter
、\chapter*
表格和图表列表以及参考书目(如果其出现在文档的最后)配合使用。
完整更新的示例(相关变化仅发生在序言中):
\documentclass[12pt]{dalthesis}
\begin{filecontents}{\jobname.bbl}
\begin{thebibliography}{1}
\bibitem[1]{latex-by-lamport}\LaTeX\ by Lamport
\bibitem[2]{latex-companion}\LaTeX\ companion
\end{thebibliography}
\end{filecontents}
\usepackage{minitoc}
\makeatletter
% Link redefinitions for normal chapters
\let\sv@chapter\dal@chapter
\def\dal@chapter[#1]#2{%
\stepcounter{mtc}%
\sv@chapter[{#1}]{#2}\relax%
\addcontentsline{lof}{xchapter}{#1}%
\addcontentsline{lot}{xchapter}{#1}%
\ignorespaces
}
% Link redefinitions for starred chapters
\let\orig@schapter\mtc@schapter
\let\mtc@schapter\dal@schapter
% TODO: Is this @@@ thing ever used?
\def\dal@schapter{\addtocontents{@@@}{\protect\chapterbegin}\mtc@schapter}
\let\@schapter\orig@schapter
% To suppress redefinition warning
\let\mtc@hints@@schapter\@schapter
% Marker to adjust minitoc numbering in .toc file
\def\chapterbegin{\chapterbegin@}
\let\chapterbegin@\relax
% Correct minitoc numbering for starred chapters with ToC entry
\def\nonumchapter#1{%
\chapter*{#1}%
\addcontentsline{toc}{chapter}{#1}%
\addtocontents{toc}{\protect\chapterbegin}%
}
\def\prefacesection#1{%
\chapter*{#1}%
\addcontentsline{toc}{chapter}{#1}%
\addtocontents{toc}{\protect\chapterbegin}%
}
% Correct minitoc numbering for LoT/LoF
\let\orig@frontmatter\frontmatter
\def\frontmatter{%
\orig@frontmatter
\ifdal@tables@page
\addtocontents{lot}{\protect\addtocontents{toc}{\protect\protect\protect\chapterbegin}}%
\fi
\ifdal@figures@page
\addtocontents{lof}{\protect\addtocontents{toc}{\protect\protect\protect\chapterbegin}}%
\fi
}
\makeatother
\begin{document}
\title{The title} \author{Noah Body}
% The following degrees are included in the current dalthesis.cls % class file: \mcs % options are \mcs, \macs, \mec, \mhi, \phd, and \bcshon
% If you degree is not included, you can set several options manually. % The following example shows the parameters for the \mcs degree. % However, if you need to set these parameters manually, please check % the correct names with the Faculty of Graduate Studies, and let the % maintainer of this class file know (Vlado Keselj, [email protected]). % MCS Example:
\degree{Doctor of Mixology} %\degreeinitial{M.C.Sc.} \faculty{Science} \dept{Contemporary Home Economics}
% Month and Year of Defence
\defencemonth{June}\defenceyear{2013}
\dedicate{Optionally, the thesis can be dedicated to someone, and the student can enter the dedication content here.}
% This sample thesis contains no tables nor figures, so there is no % need to include lists of tables and figures in the front matter:
%\nolistoftables \nolistoffigures
\dominitoc
\frontmatter
\begin{abstract} This is a test document. \end{abstract}
\begin{acknowledgements} Thanks to all the little people who make me look tall. \end{acknowledgements}
\mainmatter
\chapter{Introduction}
Get it done! Use reference material by Lamport~\cite{latex-by-lamport} or Gooses, Mittelback, and Samarin~\cite{latex-companion}.
\chapter{Doing It}
\minitoc
\section{Getting Ready}
Get all the parts that I need. I can throw in a whole pile of terms like preparation, methodology, forethought, and analysis as examples for me to use in the future.
\section{Next Step}
Do it!
Of course, you have to have pictures to show how you did it to make people understand things better.
\chapter{Conclusion}
Did it!
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
输出