LaTeX forum ⇒ Theses, Books, Title pagesChapter Header

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
vinaykumarn
Posts: 15
Joined: Wed Oct 19, 2016 6:30 am

Chapter Header

Postby vinaykumarn » Mon Jun 05, 2017 12:57 pm

Hai,

How to remove the chapter caption (i.e., Chapter 1) in the header of each chapter. For your reference, the sample code and screen have been given.

\RequirePackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles%
\automark[chapter]{chapter}
\ihead{\headmark\raggedleft \hspace{1cm}}% Inner header % UPDATED BY VKN: REGARDING RIGHT ALIGNMENT OF CAPTION
\ohead[\pagemark]{\pagemark}% Outer header
Attachments
Query.png
Query.png (109.98 KiB) Viewed 939 times

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8534
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Jun 05, 2017 1:27 pm

This code doesn't work, \providepairofpagestyles{thesisSimple}{% has no closing brace following it.

Since you don't show any code, we don't even know the document class, we cannot test and fix. Perhaps provide a Infominimal working example, that's usually a guarantee for a solution.

Stefan
Site admin

vinaykumarn
Posts: 15
Joined: Wed Oct 19, 2016 6:30 am

Postby vinaykumarn » Mon Jun 05, 2017 4:32 pm

Sir,
Please find the below minimal working code:

  1. \NeedsTeXFormat{LaTeX2e}[1996/12/01]
  2. \newcommand{\classname}{MastersDoctoralThesis_UoM}
  3. \ProvidesClass{\classname}[2015/11/08 v1.2 LaTeXTemplates.com]
  4. \providecommand{\baseclass}{book}
  5.  
  6. \RequirePackage{etoolbox}
  7. \RequirePackage{xparse}
  8. \newbool{nolistspace}
  9. \newbool{listtoc}
  10. \newbool{toctoc}
  11. \newbool{parskip}
  12. \newbool{hyperrefsupport}
  13. \booltrue{hyperrefsupport}
  14. \newbool{headsepline}
  15.  
  16. \DeclareOption{nohyperref}{\boolfalse{hyperrefsupport}}
  17. \DeclareOption{nolistspacing}{\booltrue{nolistspace}}
  18. \DeclareOption{liststotoc}{\booltrue{listtoc}}
  19. \DeclareOption{toctotoc}{\booltrue{toctoc}}
  20. \DeclareOption{parskip}{\booltrue{parskip}}
  21. \DeclareOption{headsepline}{\booltrue{headsepline}}
  22. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
  23.  
  24. \ProcessOptions\relax
  25.  
  26. \LoadClass{\baseclass}
  27.  
  28. %----------------------------------------------------------------------------------------
  29. % CLASS OPTIONS
  30. %----------------------------------------------------------------------------------------
  31.  
  32. \ifbool{parskip}{\RequirePackage{parskip}} % If the parskip option is passed to the class, require the parskip package
  33.  
  34. \patchcmd{\@makechapterhead}{\vspace*{50\p@}}{\abovechapterspace}{}{}
  35. \patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{\abovechapterspace}{}{}
  36. \newcommand{\abovechapterspace}{\vspace*{50pt}}
  37.  
  38. \ifbool{listtoc}{% If the liststotoc option has been passed to the class, add the lists to the table of contents
  39. \patchcmd{\listoftables}{\@starttoc{lot}}{%
  40. \addchaptertocentry{\listtablename}\@starttoc{lot}}{}{}%
  41. \patchcmd{\listoffigures}{\@starttoc{lof}}{%
  42. \addchaptertocentry{\listfigurename}\@starttoc{lof}}{}{}%
  43. }
  44.  
  45. \ifbool{toctoc}{% If the toctotoc options has been passed to the class, add the table of contents to the table of contents
  46. \patchcmd{\tableofcontents}{\@starttoc{toc}}{%
  47. \addchaptertocentry{\contentsname}\@starttoc{toc}}{}{}%
  48. }
  49.  
  50. \patchcmd{\tableofcontents}{\MakeUppercase}{\MakeMarkcase}{}{}
  51. \patchcmd{\tableofcontents}{\MakeUppercase}{\MakeMarkcase}{}{}
  52. \patchcmd{\listoffigures}{\MakeUppercase}{\MakeMarkcase}{}{}
  53. \patchcmd{\listoffigures}{\MakeUppercase}{\MakeMarkcase}{}{}
  54. \patchcmd{\listoftables}{\MakeUppercase}{\MakeMarkcase}{}{}
  55. \patchcmd{\listoftables}{\MakeUppercase}{\MakeMarkcase}{}{}
  56.  
  57. % If the option `nolistspacing' is given, the spacing in the different lists is reduced to single spacing. This option is only useful, if the spacing of the document has been changed to onehalfspacing or doublespacing.
  58. \ifbool{nolistspace}{
  59. \patchcmd{\listoffigures}{%
  60. \@starttoc{lof}}{%
  61. \begingroup%
  62. \singlespace\@starttoc{lof}\endgroup%
  63. }{}{}%
  64. \patchcmd{\listoftables}{%
  65. \@starttoc{lot}}{%
  66. \begingroup%
  67. \singlespace\@starttoc{lot}\endgroup%
  68. }{}{}%
  69. \patchcmd{\tableofcontents}{%
  70. \@starttoc{toc}}{%
  71. \begingroup%
  72. \singlespace\@starttoc{toc}\endgroup%
  73. }{}{}%
  74. }{}
  75.  
  76. % Addchap provides unnumbered chapters with an entry in the table of contents as well as an updated header
  77. \ProvideDocumentCommand{\addchap}{ s o m }{%
  78. \chapter*{#3}%
  79. \markboth{}{}%
  80. \IfBooleanTF{#1}{%
  81. }{%
  82. \IfNoValueTF{#2}{%
  83. \addchaptertocentry{#3}%
  84. \markboth{\MakeMarkcase{#3}}{\MakeMarkcase{#3}}%
  85. }{%
  86. \addchaptertocentry{#2}%
  87. \markboth{\MakeMarkcase{#2}}{\MakeMarkcase{#2}}%
  88. }%
  89. }%
  90. }%
  91.  
  92. \ProvideDocumentCommand{\addsec}{ s o m }{%
  93. \section*{#3}%
  94. \markright{}%
  95. \IfBooleanTF{#1}{%
  96. }{%
  97. \IfNoValueTF{#2}{%
  98. \addcontentsline{toc}{section}{#3}%
  99. \markright{\MakeMarkcase{#3}}%%
  100. }{%
  101. \addcontentsline{toc}{section}{#2}%
  102. \markright{\MakeMarkcase{#2}}%
  103. }%
  104. }%
  105. }%
  106.  
  107. %----------------------------------------------------------------------------------------
  108. % REQUIRED PACKAGES
  109. %----------------------------------------------------------------------------------------
  110.  
  111. \RequirePackage{babel} % Required for automatically changing names of document elements to languages besides english
  112.  
  113. \RequirePackage{scrbase} % Required for handling language-dependent names of sections/document elements
  114.  
  115. \RequirePackage{scrhack} % Loads fixes for various packages
  116.  
  117. \RequirePackage{setspace} % Required for changing line spacing
  118.  
  119. \RequirePackage{longtable} % Required for tables that span multiple pages (used in the symbols, abbreviations and physical constants pages)
  120.  
  121. \RequirePackage{siunitx} % Required for \SI commands
  122.  
  123. \RequirePackage{graphicx} % Required to include images
  124. \graphicspath{{Figures/}{./}} % Specifies where to look for included images
  125.  
  126. \RequirePackage{booktabs} % Required for better table rules
  127.  
  128. \RequirePackage[centerlast,small,sc]{caption} % Required for customising the captions
  129. \setlength{\captionmargin}{50pt}
  130.  
  131. %----------------------------------------------------------------------------------------
  132.  
  133. \newcommand{\checktoopen}{% New command to move content to the next page which prints to the next odd page if twosided mode is active
  134. \if@openright\cleardoublepage\else\clearpage\fi
  135. \ifdef{\phantomsection}{\phantomsection}{}% The \phantomsection command is necessary for hyperref to jump to the correct page
  136. }
  137.  
  138. \newcommand\bhrule{\typeout{--------------------}}
  139. \newcommand\tttypeout[1]{\bhrule\typeout{\space #1}\bhrule}
  140.  
  141. \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % New command to make the lines in the title page
  142. \newcommand{\decoRule}{\rule{.8\textwidth}{.4pt}} % New command for a rule to be used under figures
  143. % ************************************* IMPORTANT VKN ******************************* %
  144. \renewcommand{\abovechapterspace}{\vspace*{10pt}} % Reduce the whitespace above a chapter heading
  145. % *********************************************************************************** %
  146. \setcounter{tocdepth}{3} % The depth to which the document sections are printed to the table of contents
  147. % ************************* IMPORTANT: ADDING DIFFERENT CHAPTER CONTENTS - VKN ****************** %
  148. \providecommand\addchaptertocentry[1]{%
  149. \addcontentsline{toc}{chapter}{#1}%
  150. % *********************************************************************************************** %
  151. }
  152.  
  153. %----------------------------------------------------------------------------------------
  154. % MARGINS
  155. %----------------------------------------------------------------------------------------
  156.  
  157. \RequirePackage{geometry}
  158. \geometry{
  159. headheight=4ex,
  160. includehead,
  161. includefoot
  162. }
  163.  
  164. \raggedbottom
  165.  
  166. %----------------------------------------------------------------------------------------
  167. % PENALTIES
  168. %----------------------------------------------------------------------------------------
  169.  
  170. \doublehyphendemerits=10000 % No consecutive line hyphens
  171. \brokenpenalty=10000 % No broken words across columns/pages
  172. \widowpenalty=9999 % Almost no widows at bottom of page
  173. \clubpenalty=9999 % Almost no orphans at top of page
  174. \interfootnotelinepenalty=9999 % Almost never break footnotes
  175.  
  176. %----------------------------------------------------------------------------------------
  177. % HEADERS AND FOOTERS
  178. %----------------------------------------------------------------------------------------
  179.  
  180. \RequirePackage[markcase=used]{scrlayer-scrpage}
  181. \providepairofpagestyles{thesisSimple}{%
  182. \clearpairofpagestyles%
  183. \automark[chapter]{chapter}
  184. \ihead{\headmark\raggedleft \hspace{1cm}}% Inner header % UPDATED BY VKN: REGARDING RIGHT ALIGNMENT OF CAPTION
  185. \ohead[\pagemark]{\pagemark}% Outer header
  186. }
  187. \ifoot{}% Inner footer
  188. \ofoot{}% Outer footer
  189. \pagestyle{thesisSimple}
  190. \providepairofpagestyles[thesisSimple]{thesis}{%
  191. \automark*[section]{}%
  192. }
  193. \providepairofpagestyles[thesisSimple]{review}{%
  194. \ofoot[\ttitle/\authorname]{\ttitle/\authorname}
  195. \ifoot[\today]{\today}
  196. }
  197. \pagestyle{thesis}
  198. \ifbool{headsepline}{\KOMAoption{headsepline}{true}}{}
  199. \PreventPackageFromLoading[\ClassError{\classname}{Package `fancyhdr' is
  200. incompatible\MessageBreak with this class}{The pagesyles are defined
  201. using package `scrlayer-scrpage', please consult the\MessageBreak
  202. KOMA-script documentation for details.}]{fancyhdr}
  203.  
  204.  
  205. \newcommand{\blank@p@gestyle}{empty}
  206. \newcommand{\blankpagestyle}[1]{\def\blank@p@gestyle{#1}}
  207.  
  208. \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  209. \hbox{}
  210. \thispagestyle{\blank@p@gestyle}
  211. \newpage
  212. \if@twocolumn\hbox{}\newpage\fi\fi\fi}
Last edited by Stefan Kottwitz on Sun Jun 11, 2017 1:39 pm, edited 1 time in total.
Reason: code marked

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Jun 05, 2017 8:25 pm

Usually, that would be done using just \renewcommand{\chaptermarkformat}{} in the preamble.

Anyway, i didn't look into your modification of the template, since only the original template as found on latextemplates.com are supported. Also, only the recent version and one version back are supported.

Current version of the class file is 1.5.


Also, why do you change the class file if it is not needed. As far as i can tell, all changes could have been made in the preamble of the document, like it is supposed to be. Changing a class file for inexperienced users is highly discouraged.

Edit: We already covered that months back. But i honestly made a mistake by confusing inner and outer margin based on the screenshot.
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

Postby vinaykumarn » Tue Jun 06, 2017 12:08 pm

Hai sir,

Your suggestion is still not working. I have put your codes in the preamble of chapter.tex but it is not working...?

Thanking in advance.

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Jun 06, 2017 1:09 pm

You did not provide a minimal workung example in the past and you didn't provide one now. How are we supposed to know why it doesn't work for you?

A minimal example is essential to help you.
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

Postby vinaykumarn » Sun Jun 11, 2017 10:09 am

Thank you sir. Problem is solved...

vinaykumarn
Posts: 15
Joined: Wed Oct 19, 2016 6:30 am

Postby vinaykumarn » Sun Jun 11, 2017 10:16 am

Sir,
How to remove the huge space before the following sections
1. Chapter heading of each chapter
2. Contents
3. List of Figures
4. List of Tables
5. Abbreviations
Please do the needful. Find the minimal code below for your reference.

Thanking you



  1. %----------------------------------------------------------------------------------------
  2. % HEADERS AND FOOTERS
  3. %----------------------------------------------------------------------------------------
  4.  
  5. \RequirePackage[markcase=used]{scrlayer-scrpage}
  6. \providepairofpagestyles{thesisSimple}{%
  7. \clearpairofpagestyles%
  8. \automark[chapter]{chapter}
  9. \ihead{\headmark\raggedleft \hspace{1cm}}
  10. \ohead[\pagemark]{\pagemark}% Outer header
  11. }
  12. \ifoot{}% Inner footer
  13. \ofoot{}% Outer footer
  14. \pagestyle{thesisSimple}
  15. \providepairofpagestyles[thesisSimple]{thesis}{%
  16. \automark*[section]{}%
  17. }
  18. \providepairofpagestyles[thesisSimple]{review}{%
  19. \ofoot[\ttitle/\authorname]{\ttitle/\authorname}
  20. \ifoot[\today]{\today}
  21. }
  22. \pagestyle{thesis}
  23. \ifbool{headsepline}{\KOMAoption{headsepline}{true}}{}
  24. \PreventPackageFromLoading[\ClassError{\classname}{Package `fancyhdr' is
  25. incompatible\MessageBreak with this class}{The pagesyles are defined
  26. using package `scrlayer-scrpage', please consult the\MessageBreak
  27. KOMA-script documentation for details.}]{fancyhdr}
  28.  
  29.  
  30. \newcommand{\blank@p@gestyle}{empty}
  31. \newcommand{\blankpagestyle}[1]{\def\blank@p@gestyle{#1}}
  32.  
  33. \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  34. \hbox{}
  35. \thispagestyle{\blank@p@gestyle}
  36. \newpage
  37. \if@twocolumn\hbox{}\newpage\fi\fi\fi}
Last edited by Stefan Kottwitz on Sun Jun 11, 2017 1:27 pm, edited 1 time in total.
Reason: code marked

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Jun 11, 2017 11:19 am

Please stop posting (and hence distributing) completely unrelated stuff from a class file.

Without a minimal working example, the following works for the default template: \renewcommand{\abovechapterskip}{\vspace{0pt}}

Since you don't seem to understand what a minimal working example is, find a useful link here: How to create a minimal working example?
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: 8534
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Jun 11, 2017 1:37 pm

With a pretty new TeX installation and KOMA-Script:

\RedeclareSectionCommand[beforeskip=0pt]{chapter}

With an older one:

\renewcommand{\chapterheadstartvskip}{\vspace{0pt}}

You can insert something for the distance instead of 0pt.

As Johannes said, a Infominimal working example is quite important and often a guarantee for a solution. I understand, that it may be difficult in case of your template or document structure. Anyway take a look at the Infominimal working example link and Johannes' link above, to better understand. Or this one. It can really help next time. ;)

Stefan
Site admin


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 2 guests