![编号章节](https://linux22.com/image/374129/%E7%BC%96%E5%8F%B7%E7%AB%A0%E8%8A%82.png)
我希望我的书的章节在目录中进行编号(我已经实现了),并且在文本中,例如
1 - 简介(请注意,缺少“第 1 章 -”,而只是写着“1 - ”
目前发生的事情是,我得到了
Introduction
1.1 Section
1.2 Section
New Chapter
2.1 Section
2.2 Section
但这应该是
1 - Introduction
1.1 Section
1.2 Section
2 - New Chapter
2.1 Section
2.2 Section
我正在使用硕士博士论文模板来自 latextemplates。
答案1
经验法则:不要更改类或包文件,这会使支持变得非常复杂。
该模板几乎使用默认的章节格式作为底层 book
类。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis
% LaTeX Template
% Version 2.5 (27/8/17)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel ([email protected])
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
english, % ngerman for German
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage{blindtext}
\begin{document}
\chapter{Wombat}
\blindtext
\end{document}
取消注释全局选项chapterinoneline
已经给出了非常接近期望的结果。
要获取破折号,可以重新定义\autodot
宏。还有辅助宏可以更改间距。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis
% LaTeX Template
% Version 2.5 (27/8/17)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel ([email protected])
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
english, % ngerman for German
chapterinoneline, % Uncomment to place the chapter title next to the number on one line
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage{blindtext}
\renewcommand{\autodot}{~-}
\renewcommand{\chapterbelowskip}{\vspace{100pt}}
\renewcommand{\abovechapterskip}{}
\begin{document}
\chapter{Wombat}
\blindtext
\end{document}
上述代码给出了下图的结果(章节标题上方没有空间,下方有较大的空间):
请注意不一致的命名约定。
一般建议:不要使用模板,而是从头开始最小模板并且只添加您真正需要的内容。