1

I'm trying to change few things about my table of contents to conform to submission guidelines.

  • First the word "Chapter" must be inserted above the first chapter and aligned with the numerals.

  • Second, I need to insert an empty line between different levels, i.e. one line between a chapter entry and a section, but not between multiple sections and so on.

  • Also, I'd like to capitalize all the chapter titles. Right now, I've done this by naming the chapters in all caps in their own files, but I feel there must be a better way.

Here's my MWE.

\documentclass[oneside,11pt,paper=letter,listof=nochaptergap]{scrbook}

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


\KOMAoptions{toc=listof} % place lists of figures and tables unnumbered in table of contents
\KOMAoptions{bibliography=totoc}

\AfterTOCHead[lof]{\noindent\textbf{\figurename}\hfill \textbf{Page}\par}
\AfterTOCHead[lot]{\noindent\textbf{\tablename}\hfill \textbf{Page}\par}
\DeclareTOCStyleEntry[
beforeskip=\baselineskip,
indent=0pt
]{default}{figure}
\DeclareTOCStyleEntry[
beforeskip=\baselineskip,
indent=0pt
]{default}{table}
\DeclareTOCStyleEntry[
beforeskip=\baselineskip,
indent=0pt
]{default}{chapter}


\begin{document}

\frontmatter % start roman numerals on title page

\chapter{Abstract}
this is an abstract.

\renewcommand*{\contentsname}{TABLE OF CONTENTS}    
\tableofcontents % (required)

\renewcommand{\listtablename}{LIST OF TABLES}
\listoftables % (when appropriate)

\renewcommand{\listfigurename}{LIST OF FIGURES}
\listoffigures % (when appropriate)

\mainmatter

\chapter{First Chapter}     
this is a chapter
\captionof{figure}{Figure in first chapter}
\section{Section}
\section{No Space Between Us}
\subsection{But I Need a Space}

\chapter{Second Chapter}        
this is a chapter
\section{Section}
\section{No Space Between Us}
\subsection{But I Need a Space}

\end{document}

Edit:

I managed to get the spacing right by adding:

\DeclareTOCStyleEntry[
onstarthigherlevel= \vspace{\baselineskip},
onstartlowerlevel= \vspace{\baselineskip}
]{default}{section}
\DeclareTOCStyleEntry[
onstarthigherlevel= \vspace{\baselineskip},
onstartlowerlevel= \vspace{\baselineskip}
]{default}{subsection}

Also, it looks like I can add the word "Chapter" with \addxcontentsline, however it comes with a page number that I can't figure out how to remove. Any ideas what to do about this?

1 Answer 1

1

You can declare an own entry style for the chapter prefix and patch \addchaptertocentry and \addchapterlinesformat:

\documentclass[oneside,paper=letter]{scrbook}
\usepackage{blindtext}% only for dummy text
\usepackage[margin=1in,left=1.5in]{geometry}

\KOMAoption{listof}{totoc,nochaptergap}
\KOMAoptions{bibliography=totoc}

\AfterTOCHead[lof]{\noindent\textbf{\figurename}\hfill \textbf{Page}\par}
\AfterTOCHead[lot]{\noindent\textbf{\tablename}\hfill \textbf{Page}\par}

\DeclareTOCStyleEntry[
  level=\chaptertocdepth,
  numwidth=0pt,
  indent=0pt,
  entryformat=\usekomafont{chapterentry},
  pagenumberformat=\phantom,
  linefill=\hfill
]{default}{chapterprefix}

\DeclareTOCStyleEntries[
  beforeskip=\baselineskip,
  indent=0pt
]{default}{chapterprefix,chapter,figure,table}

\DeclareTOCStyleEntries[
  onstarthigherlevel= \vspace{\baselineskip},
  onstartlowerlevel= \vspace{\baselineskip}
]{default}{section,subsection}

\usepackage{xpatch}
\xpatchcmd{\chapterlinesformat}
  {#3}
  {\MakeUppercase{#3}}
  {}{\PatchFailedI}
\xpatchcmd{\addchaptertocentry}
  {\addtocentrydefault{chapter}{#1}{#2}}
  {%
    \ifnum \value{chapter}=1 \addtocentrydefault{chapterprefix}{}{\MakeUppercase{\chaptername}}\fi
    \addtocentrydefault{chapter}{#1}{\MakeUppercase{#2}}%
  }
  {}{\PatchFailedII}

\begin{document}
\frontmatter
\chapter{Abstract}
This is an abstract.
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\chapter{First Chapter}
This is a chapter
\captionof{figure}{Figure in first chapter}
\section{Section}
\section{No Space Between Us}
\subsection{But I Need a Space}
\chapter{Second Chapter}
This is a chapter
\section{Section}
\section{No Space Between Us}
\subsection{But I Need a Space}
\blinddocument
\blinddocument
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .