Theses, Books, Title pagesChapter Header

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapter Header

Post by Johannes_B »

No Stefan, this won't work. The template does not use a KOMA-script class.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Chapter Header

Post by Stefan Kottwitz »

In the code snippet of the previous post I saw it starting with scrlayer-scrpage, no class, that was an indication for me.

If not, it's an indication that a KOMA-Script based template would really be recommendable. :-)

Not checked if it works with scrbase and scrhack, that was loaded more far above.

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapter Header

Post by Johannes_B »

The class never changed, it stayed with book. But some packages of the KOMA-bundle have been included, some commands have been added that resemble KOMA-commands (but do far less of the compicated stuff).

Edit: I should note that \abovechapterskip is defined since versioin 2.4 of the template, dating november 2016.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
vinaykumarn
Posts: 15
Joined: Wed Oct 19, 2016 6:30 am

Chapter Header

Post by vinaykumarn »

Respected sir,

First of all I would like to thank both of you for your kind and sincere suggestion. But, I have updated the .cls file only after changing the name of the class file to "MastersDoctoralThesis_UoM."

Regarding, the last request of removing un-necessary space above contents, list of tables, list of figures and chapter is not yet solved. Please find the small piece of code below and help me out in this regard.

\renewcommand{\abovechapterspace}{\vspace{0pt}}
\usepackage{titlesec}
\titleformat{\chapter}[display]
%{\normalfont\huge\bfseries\raggedleft}{%
%\chaptertitlename\ \thechapter\\[3.5ex]\titlerule}
{\normalfont\huge\bfseries\raggedleft}{\chaptertitlename\ \thechapter \\ \hrulefill}
{24pt}{\Huge}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapter Header

Post by Johannes_B »

This still is not a minimal working example, but nevermind. How should have anyone guessed, that you are using package titlesec? What you are looking for is
\titlespacing*{\chapter}{0cm}{-\topskip}{2\baselineskip}[0pt]

With an unmodified and up to date version of the template, this can be done with just three (or four) lines of code.

Code: Select all

\renewcommand{\abovechapterskip}{}
\renewcommand{\chapterinbetweenskip}{\rule{\linewidth}{.4pt}\par}
\renewcommand{\chapteralign}{\raggedleft}
\renewcommand{\chapterprefixfont}{\huge\bfseries}
Which brings me back a few months.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
vinaykumarn
Posts: 15
Joined: Wed Oct 19, 2016 6:30 am

Chapter Header

Post by vinaykumarn »

Respected Sir,

Thank you sir, the single line code worked fine.

One more clarification related to heading, we need to add horizontal line below the table of contents, list of figure, and list of tables just similar to chapter title. Please help me out in this regard. The following is the sample code:

Code: Select all

\documentclass[
12pt, % The default document font size, options: 10pt, 11pt, 12pt
oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
onehalfspacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
%liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
%toctotoc, % Uncomment to add the main table of contents to the table of contents
parskip, % Uncomment to add space between paragraphs
%nohyperref, % Uncomment to not load the hyperref package
%headsepline, % Uncomment to get a line under the header
]

\usepackage{titlesec}
\titleformat{\chapter}[display]
%{\normalfont\huge\bfseries\raggedleft}{%
   %\chaptertitlename\ \thechapter\\[3.5ex]\titlerule}
 {\normalfont\huge\bfseries\raggedleft}{\chaptertitlename\ \thechapter \\ \hrulefill}
  {24pt}{\Huge}
  
\titlespacing*{\chapter}{0cm}{-2\topskip}{2\baselineskip}[0pt] % TO REMOVE TOP SPACE AND BASELINE SPACE OF CHAPTER, TABLE OF CONTENTS, FIGURES, AND TABLES

%----------------------------------------------------------------------------------------
%	LIST OF CONTENTS/FIGURES/TABLES PAGES
%----------------------------------------------------------------------------------------

\tableofcontents % Prints the main table of contents

\listoffigures % Prints the list of figures

\listoftables % Prints the list of tables


\end{document}
Last edited by Stefan Kottwitz on Wed Jun 21, 2017 12:31 pm, edited 1 time in total.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapter Header

Post by Johannes_B »

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Chapter Header

Post by Stefan Kottwitz »

Here is an example:

Code: Select all

\documentclass[12pt,oneside,english,onehalfspacing,nolistspacing,parskip]{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]
 {\normalfont\huge\bfseries\raggedleft}{\chaptertitlename\ \thechapter \\ \hrulefill}
  {24pt}{\Huge}
\titleformat{name=\chapter,numberless}[block]
 {\normalfont\huge\bfseries\raggedleft}{}
  {24pt}{\Huge}[\hrulefill]
\newcommand*{\NumberingOff}{\setcounter{secnumdepth}{-1}}
\newcommand*{\NumberingOn}{\setcounter{secnumdepth}{2}}
\titlespacing*{\chapter}{0cm}{-2\topskip}{2\baselineskip}[0pt]
\begin{document}
\NumberingOff
\tableofcontents
\listoffigures
\listoftables
\NumberingOn
\chapter{First One}
\end{document}
Stefan
LaTeX.org admin
Post Reply