Page LayoutFormatting of chapter titles

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Formatting of chapter titles

Post by Seanshine »

Dear Readers,

I've got a questions with regards to the MastersDoctoralThesis.cls file. Namely, I would like the prefix 'Chapter X' removed and only show the chapter name instead. For example, 'Chapter 1; Introduction' -> '1 Introduction'.

Thanks in advance.

PS. I've tried to use,

Code: Select all

\addchap{Introduction}
, however it messes up the chapter numbering.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting of chapter titles

Post by Johannes_B »

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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{\chaptermarkformat}{\thechapter\space}
\begin{document}
\chapter{Wombat}
\blindtext[10]
\end{document}
Package scrlayer-scrpage is used to define the headers and footers.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Formatting of chapter titles

Post by Seanshine »

@Johannes_B Hero!

One more question: where would one place \renewcommand{\chaptermarkformat}{\thechapter\space}? And what is its use?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting of chapter titles

Post by Johannes_B »

In the document preamble as shown.

It's use? It formats the chapter mark to what you want.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Formatting of chapter titles

Post by Seanshine »

Ah. Great.

I was in doubt whether to change the .cls file or the main.tex whenever one wants to make any changes. But from my understanding one has to make adaptions only in the main.tex, correct?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting of chapter titles

Post by Johannes_B »

Yes, this is correct. There is no need to change the class file at all. This is by design in LaTeX.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Formatting of chapter titles

Post by Seanshine »

Finally I understand. So when I want to change the header to '1 Introduction Author p. X', what code would one insert and where within the main.tex?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting of chapter titles

Post by Johannes_B »

\ihead{\headmark\space Author p. X} in the preamble.

All customization is done in the preamble.

You need to read an introduction to learn LaTeX which is needed to use the template.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Formatting of chapter titles

Post by Seanshine »

'The Not So Short Introduction to LaTeX', I will go through that step by step.

Thanks for the support.
Post Reply