Currently I am using scrreprt
for my document with the option chapterprefix=true
. I wish for my chapters prefixes to be of the form: "CHAPTER ONE" as opposed to "Chapter 1". Now, I know that fmtcounter
and moreenum
can convert numbers to words but am unsure how to go about formatting the prefix.
[Tex/LaTex] KOMA-Script: Chapter Number as a Word
chapterskoma-scriptsectioning
Related Solutions
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}
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}
Partial answer, because I was lately trying something similar. Updated with @speravir’s suggestions and two ugly solutions of putting \dictum
between prefixed chapter number and chapter title.
\documentclass[
headings=big,
chapterprefix=true%% like in standard class "report"
]{scrreprt}
%\usepackage[T1]{fontenc}%% pdflatex
\usepackage{fontspec}%% xelatex
\usepackage{xcolor}
\usepackage{graphicx}
%% partial TOCs after chapter title
\usepackage[]{minitoc}
\setcounter{secnumdepth}{3} % number subsubsections
\setcounter{tocdepth}{3} % list subsubsections
\mtcsetdepth{minitoc}{2}% ~ \setcounter{minitocdepth}{2}
\mtcsetfont{minitoc}{*}{\usekomafont{chapterentry}}
\mtcsetfont{minitoc}{section}{\usekomafont{chapterentry}\bfseries}
\mtcsetfont{minitoc}{subsection}{\usekomafont{chapterentry}}
\mtcsettitle{minitoc}{\relax}% remove “Contents”
\mtcsetoffset{minitoc}{-3.5em}% don’t know the appropriate length
\mtcsetrules{minitoc}{off}
\mtcsetpagenumbers{minitoc}{on}% default anyway
%\mtcsetfeature{minitoc}{before|after|open|close|pagestyle}{command}
%% layout of chapter title by @Speravir
\addtokomafont{chapterprefix}{\raggedleft}
\renewcommand*{\chapterformat}{%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{5}{\color{gray}\thechapter\autodot}\enskip}%
}
%% put dictum between chapter number (with prefix) and title
%% \setdictum[⟨source⟩]{⟨quote⟩} -- before \chapter
\iftrue % change to \iffalse to test different approach
%% hacky approach
\newcommand\getdictum{\relax}
\newcommand\setdictum[2][]{\renewcommand\getdictum{\dictum[#1]{#2}}}
\usepackage{etoolbox}
\makeatletter
%% \patchcmd{⟨command⟩}{⟨search⟩}{⟨replace⟩}{⟨success⟩}{⟨failure⟩}
\patchcmd{\@@makechapterhead}{\size@chapterprefix{}}{\size@chapterprefix{}{\vskip 1em\getdictum}}{}{}
\makeatother
\else
%
\newcommand\setdictum[2][]{%
\setchapterpreamble[ol][0.5\textwidth]{\vskip 5em\dictum[#1]{#2}}%
}
\fi
\begin{document}
\dominitoc
\faketableofcontents
\setcounter{chapter}{6}\setcounter{page}{199}
\setdictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}
\chapter{Conclusions}
\minitoc
\section{Summary of Achievements}
Text goes here
\newpage\setcounter{page}{212}
\subsection{Papers Submitted}
\subsubsection{I want to go into the TOC}
\end{document}
Best Answer
The answer to the question
shows a way changing the chapter number in all places:
However, this affects also cross-references, and section numbering such as poducing One.1 instead of 1.1, which is consistent could be undesired. If you would like to change the prefix and number in the headings, not changing the general presentation of the counter, you could redefine
\chapterformat
. Furthermore, if you would like to change the marks in the header in the same way, you could adjust\chaptermarkformat
.