1

I'd like my front matter (ToC, LoF, LoT) to show within my ToC on the same level as sections (as opposed to chapters)...

MWE:

\documentclass[]{scrbook}

\KOMAoptions{twoside=false}

\usepackage{tocbibind}

\addtokomafont{partentrypagenumber}{\nullfont}
\addtokomafont{chapterentrypagenumber}{\mdseries}       

\usepackage{tocstyle}
    \usetocstyle{allwithdot}
    \settocstylefeature[-1]{leaders}{\hfill}
    \settocstylefeature[-1]{pagenumberhook}{\nullfont}

\usetocstyle{KOMAlike}
    \usetocstyle{allwithdot}
    \settocstylefeature[-1]{leaders}{\hfill}
    \settocstylefeature[-1]{pagenumberhook}{\nullfont}
\renewcommand*{\addparttocentry}[2]{%
    \addtocentrydefault{part}{\partname\nobreakspace #1}{#2}%
    }%

\begin{document}

\frontmatter

\part*{Front Matter}
    \addcontentsline{toc}{part}{Front Matter}

\tableofcontents
\listoftables
\listoffigures

\mainmatter

\part*{Report}
    \addcontentsline{toc}{part}{Report}

\chapter{Chapter 1}
    \section{Section 1}
    \section{Section 2}
    \section{Section 3}

\appendix

\part*{Appendices}
    \addcontentsline{toc}{part}{Appendices}

\chapter{Appendix 1}
    \section{Appendix Section 1}
    \section{Appendix Section 2}
    \section{Appendix Section 3}

\end{document}
1
  • 1
    tocbibind and KOMA? ... and explicit \addcontentsline statements..
    – user31729
    Commented Oct 21, 2017 at 21:41

1 Answer 1

3

First of all I would remove packages tocbibind and tocstyle and the \addcontentsline statements from your MWE:

\documentclass[
  twoside=false,
  listof=totoc,% add a tocentry for lists like LOF and LOT
  toc=chapterentrywithdots% dots as line filler for chapter entries in TOC
]{scrbook}
\setuptoc{toc}{totoc}% add a tocentry for TOC

\DeclareTOCStyleEntry[
  dynnumwidth,% adjust the space for part numbers in TOC as needed
  entrynumberformat=\partnumberwithprefix,% part number with prefix
  pagenumberformat=\gobble% remove page number of part entries in TOC
]{tocline}{part}
\newcommand\partnumberwithprefix[1]{\partname\nobreakspace#1}
\newcommand\gobble[1]{}

\addtokomafont{chapterentrypagenumber}{\mdseries}
\begin{document}
\frontmatter
\addpart{Front Matter}
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\addpart{Report}
\chapter{Chapter 1}
    \section{Section 1}
    \section{Section 2}
    \section{Section 3}

\appendix
\addpart{Appendices}
\chapter{Appendix 1}
    \section{Appendix Section 1}
    \section{Appendix Section 2}
    \section{Appendix Section 3}
\end{document}

Result:

enter image description here


If TOC, LOF and LOT should be sections instead chapters you could use lists=leveldown and \setuptoc{toc}{leveldown}:

\documentclass[
  twoside=false,
  listof=totoc,
  listof=leveldown,% <- added
  toc=chapterentrywithdots
]{scrbook}
\setuptoc{toc}{totoc,leveldown}% <- changed

\DeclareTOCStyleEntry[
  dynnumwidth,
  entrynumberformat=\partnumberwithprefix,
  pagenumberformat=\gobble
]{tocline}{part}
\newcommand\partnumberwithprefix[1]{\partname\nobreakspace#1}
\newcommand\gobble[1]{}

\addtokomafont{chapterentrypagenumber}{\mdseries}
\begin{document}
\frontmatter
\addpart{Front Matter}
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\addpart{Report}
\chapter{Chapter 1}
    \section{Section 1}
    \section{Section 2}
    \section{Section 3}

\appendix
\addpart{Appendices}
\chapter{Appendix 1}
    \section{Appendix Section 1}
    \section{Appendix Section 2}
    \section{Appendix Section 3}
\end{document}

Result:

enter image description here


But if you really want that TOC, LOF and LOT are still chapters but get TOC entries like sections, then you could add

\BeforeTOCHead{%
    \renewcommand\addchaptertocentry[2]
        {\addtocentrydefault{section}{#1}{#2}}%
}

to the first example.

enter image description here

Code:

\documentclass[
  twoside=false,
  listof=totoc,
  toc=chapterentrywithdots
]{scrbook}
\setuptoc{toc}{totoc}

\BeforeTOCHead{%
    \renewcommand\addchaptertocentry[2]
        {\addtocentrydefault{section}{#1}{#2}}%
}

\DeclareTOCStyleEntry[
  dynnumwidth,
  entrynumberformat=\partnumberwithprefix,
  pagenumberformat=\gobble
]{tocline}{part}
\newcommand\partnumberwithprefix[1]{\partname\nobreakspace#1}
\newcommand\gobble[1]{}

\addtokomafont{chapterentrypagenumber}{\mdseries}
\begin{document}
\frontmatter
\addpart{Front Matter}
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\addpart{Report}
\chapter{Chapter 1}
    \section{Section 1}
    \section{Section 2}
    \section{Section 3}

\appendix
\addpart{Appendices}
\chapter{Appendix 1}
    \section{Appendix Section 1}
    \section{Appendix Section 2}
    \section{Appendix Section 3}
\end{document}
1
  • Works perfectly!
    – E. McLean
    Commented Oct 22, 2017 at 0:05

You must log in to answer this question.

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