8

My university has style requirements for my dissertation that seem to be tailored to users of MS Word and the like. In particular, the formatting of section headers differs only by use of caps/bold/italics from the rest of the text. What I need is to replicate chapter headings that in MS Word would result from the following input sequence:

  • [entire document double-spaced]
  • Chapter 1 [return]
  • Chapter Title [return]
  • This is the text of the chapter....

The only thing I haven't figured out is how to force the vertical space between the prefix and title to be a simple double-space just like everywhere else in the document. What am I missing?

\documentclass[12pt,letterpaper,oneside,chapterprefix=on]{scrbook}

%Margins
\usepackage[letterpaper,left=1.5in,top=1in,right=1in,bottom=1in]{geometry}

%Type
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\usepackage[doublespacing]{setspace}
\setlength\parindent{0.5in}

\usepackage{microtype}
\usepackage{lipsum}

%Remove vertical space above/below chapter headings:
%http://tex.stackexchange.com/questions/43087/remove-space-before-chapter-title-with-koma-      script-scrbook
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0in}}

\setkomafont{disposition}{\normalcolor\rmfamily}
\setkomafont{chapter}{\centering\MakeUppercase}

\begin{document}

\frontmatter

\chapter*{Abstract Title Page}
\chapter*{Abstract}
\chapter*{Copright Page}
\chapter*{Title Page}

\tableofcontents
\listoffigures

\mainmatter

\chapter{Introduction}
\lipsum[1-2]
\appendix
\backmatter

\end{document}
7

The scrbook class introduces an additional \vskip of .5\baselineskip between the heading "Chapter" and the title; unfortunately this skip is hard-coded, so you will have to redefine \@@makechapterhead to suppress it:

\documentclass[12pt,letterpaper,oneside,chapterprefix=on]{scrbook}

%Margins
\usepackage[letterpaper,left=1.5in,top=1in,right=1in,bottom=1in]{geometry}

%Type
\usepackage{fontspec}
%\setmainfont{Times New Roman}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\usepackage[doublespacing]{setspace}
\setlength\parindent{0.5in}

\usepackage{microtype}
\usepackage{lipsum}

%Remove vertical space above/below chapter headings:
%http://tex.stackexchange.com/questions/43087/remove-space-before-chapter-title-with-koma-      script-scrbook
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0in}}
\renewcommand*{\chapterformat}{\chapappifchapterprefix{\nobreakspace}\thechapter}

\setkomafont{disposition}{\normalcolor\rmfamily}
\setkomafont{chapter}{\centering\MakeUppercase}

\makeatletter
\renewcommand*{\@@makechapterhead}[1]{\chapterheadstartvskip
  {%
    \setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}%
    \normalfont\sectfont\nobreak\size@chapter{}%
    \if@chapterprefix
      \let\@tempa\raggedsection
    \else
      \let\@tempa\@hangfrom
    \fi
    \@tempa{\ifnum \c@secnumdepth >\m@ne%
        \if@mainmatter
          \if@chapterprefix
            \expandafter\size@chapterprefix
          \else
            \expandafter\size@chapter
          \fi
          {\chapterformat}%
          \if@chapterprefix
            \size@chapterprefix{}\endgraf\nobreak%\vskip\baselineskip
          \fi
        \fi
      \fi
    }%
    {\raggedsection \interlinepenalty\@M\size@chapter{#1}\par}}%
  \nobreak\chapterheadendvskip
}
\makeatother

\begin{document}

\frontmatter

\chapter*{Abstract Title Page}
\chapter*{Abstract}
\chapter*{Copright Page}
\chapter*{Title Page}

\tableofcontents
\listoffigures

\mainmatter

\chapter{Introduction}
\lipsum[1-2]
\appendix
\backmatter

\end{document}

enter image description here

With the etoolbox package, one can do this in one-line patching \@@makechapterhead:

\documentclass[12pt,letterpaper,oneside,chapterprefix=on]{scrbook}

%Margins
\usepackage[letterpaper,left=1.5in,top=1in,right=1in,bottom=1in]{geometry}

%Type
\usepackage{fontspec}
%\setmainfont{Times New Roman}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\usepackage[doublespacing]{setspace}
\setlength\parindent{0.5in}

\usepackage{microtype}
\usepackage{etoolbox}
\usepackage{lipsum}

%Remove vertical space above/below chapter headings:
%http://tex.stackexchange.com/questions/43087/remove-space-before-chapter-title-with-koma-      script-scrbook
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0in}}
\renewcommand*{\chapterformat}{\chapappifchapterprefix{\nobreakspace}\thechapter}

\setkomafont{disposition}{\normalcolor\rmfamily}
\setkomafont{chapter}{\centering\MakeUppercase}

\makeatletter
\patchcmd{\@@makechapterhead}{\vskip.5\baselineskip}{}{}{}
\makeatother

\begin{document}

\frontmatter

\chapter*{Abstract Title Page}
\chapter*{Abstract}
\chapter*{Copright Page}
\chapter*{Title Page}

\tableofcontents
\listoffigures

\mainmatter

\chapter{Introduction}
\lipsum[1-2]
\appendix
\backmatter

\end{document}

I commented out the line \setmainfont{Times New Roman} since I don't have that font in my system.

As egreg noticed in a comment, with the settings of the question, the heading "Chapter #" is slightly shifted to the left; to correct this, the following additional redefinition had to be added:

\renewcommand*{\chapterformat}{\chapappifchapterprefix{\nobreakspace}\thechapter}
  • The "Chapter 1" is shifted to the left; you can see it by using "Chapter 1" as title; I checked, and the title is really centered. – egreg Aug 26 '13 at 23:29
  • You have to add \renewcommand*{\chapterformat}{\chapappifchapterprefix{\nobreakspace}\thechapter} – egreg Aug 26 '13 at 23:34
  • @egreg Yes, you're right; thanks for noticing it! I'll add this to my answer. – Gonzalo Medina Aug 26 '13 at 23:37
  • 1
    The inner skip of the chapter head is not longer hard coded. You should not longer redefine \@@makechapterhead. Use \RedeclareSectionCommand (see esdd's answer) or at most redefine \chapterheadmidvskip. But redefinition of \chapterhead…vskip (like shown in this answer) can break the …skip options of \RedeclareSectionCommand. – Schweinebacke Jun 8 '17 at 6:19
  • Moreover, usage of \MakeUppercase as a font command seems to fail and usage of \centering as a font command is not recommended. – Schweinebacke Apr 3 at 9:09
4

With a KOMA-Script class use \RedeclareSectionCommand[...]{chapter} to change the skips before, after and inside the chapter heading:

\RedeclareSectionCommand[
  afterindent=false,beforeskip=0pt,% afterindent needs version 3.26 or newer
  afterskip=0pt,innerskip=0pt
]{chapter}

or

\RedeclareSectionCommand[
  beforeskip=-1sp,
  afterskip=0pt,innerskip=0pt
]{chapter}

Do not use \MakeUppercase as a font command. Its usage in the second argument of \setkomafont or \addtokomafont results in an error.

You can redefine \chapterlineswithprefixformat (used for chapter headings with chapterprefix=on) and \chapterlinesformat (used for chapter headings with chapterprefix=off, default) to get chapter headings in capital letters:

\renewcommand\chapterlineswithprefixformat[3]{%
  \ifstr{#1}{chapter}
    {\MakeUppercase{#2#3}}
    {#2#3}%
}
\makeatletter
\renewcommand\chapterlinesformat[3]{%
  \ifstr{#1}{chapter}
    {\@hangfrom{#2}{\MakeUppercase{#3}}}
    {\@hangfrom{#2}{#3}}%
}
\makeatother

Example

\documentclass[12pt,letterpaper,oneside,chapterprefix=on]{scrbook}

%Margins
\usepackage[letterpaper,left=1.5in,top=1in,right=1in,bottom=1in]{geometry}

%Type
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\usepackage[doublespacing]{setspace}
\setlength\parindent{0.5in}

\usepackage{microtype}
\usepackage{lipsum}

\RedeclareSectionCommand[
  afterindent=false,beforeskip=0pt,% afterindent needs version 3.26 or newer
  afterskip=0pt,innerskip=0pt
]{chapter}

\setkomafont{disposition}{\normalcolor\rmfamily}
\setkomafont{chapter}{}
\renewcommand*\raggedchapter{\centering}

\renewcommand\chapterlineswithprefixformat[3]{%
  \ifstr{#1}{chapter}
    {\MakeUppercase{#2#3}}
    {#2#3}%
}

%\makeatletter
%\renewcommand\chapterlinesformat[3]{%
  %\ifstr{#1}{chapter}
    %{\@hangfrom{#2}{\MakeUppercase{#3}}}
    %{\@hangfrom{#2}{#3}}%
%}
%\makeatother

\begin{document}
\frontmatter
\addchap*{Abstract Title Page}
\addchap*{Abstract}
\addchap*{Copright Page}
\addchap*{Title Page}
\tableofcontents
\listoffigures
\mainmatter
\chapter{Introduction}
\lipsum[1-2]
\chapter{Chapter 2}
\lipsum[1-2]
\appendix
\backmatter
\end{document}

enter image description here

  • 1
    You should not use \MakeUppercase as a font command. And you need afterindent=false as an additional setting. – Schweinebacke Apr 3 at 9:07

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.