0

What i would like is for the chapters of my book to be numbered in the ToC (which i have already achieved) AND in text such as

1 - Introduction (notice "Chapter 1 -" is missing and instead it just says "1 - "

What is happening at the moment is that ive got

Introduction

1.1 Section
1.2 Section

New Chapter
2.1 Section
2.2 Section

But instead this should be

1 - Introduction

1.1 Section
1.2 Section

2 - New Chapter
2.1 Section
2.2 Section

I am using the masters doctoral thesis template from latextemplates.

  • 1
    Could you please make your code snippet compilable? – TeXnician Apr 15 '18 at 9:22
  • 4
    I advice you not to bother with the class file at all, there is a copyright and licence you may be violating. github.com/johannesbottcher/MDT-Quick-Manual Also, why don't you just follow the Ask question button to get to the proper place to get support for that template? – Johannes_B Apr 15 '18 at 10:03
  • 1
    chapterinoneline option would give you 1 Introduction, but your question requests 1 - Introduction. That would be achieved by \renewcommand{\autodot}{~-} (untested). – Johannes_B Apr 15 '18 at 10:13
  • 4
    Please do not change the class file! It isn't yours. You are just allowed to use it. You can make any change you want in the document preamble, including redefining what you need. In this case however, i would suggest to use a minimal template. – Johannes_B Apr 15 '18 at 11:07
  • 4
    I'm voting to close this question as off-topic because the op has solved the problem (with a \renewcommand) as noted in the comments. – barbara beeton Apr 15 '18 at 14:43
1

Rule of thumb: Do not change a class or package file, it makes support very complicated.


The template uses almost the default chapter formatting as the underlying book class.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 (vel@latextemplates.com)
%
% 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}  

mdtDefaultPeter

Uncommenting the global option chapterinoneline already gives something very close to the desired result.

mdtChapterinoneline

To get the dash, one can redefine the \autodot macro. There are helper macros to change the spacing as well.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 (vel@latextemplates.com)
%
% 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}  

The code above gives the result in the image below (no space above the chapter heading, a large space below it):

mdtChapterSpace


Note the inconsistent naming convention.

General advice: Do not use a template, rather start from scratch with a minimal template and only adding what you really need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.