2

Similar to this question here, how can I indent the chapter*-like entries to the same indent as the numbered chapters? section* work with \KOMAoptions{toc=indentunnumbered}.

The main difference to the other questions concerning indent with unnumbered chapter is related to indexes: The indentation of indexes won’t work with \addchap/\addsec etc.

enter image description here

\documentclass[ngerman,twoside=false,listof=totoc,listof=leveldown]{scrbook}
\usepackage{imakeidx}
\usepackage[style=archaeologie]{biblatex}
\addbibresource{archaeologie-examples.bib}
\usepackage{babel}
\newcommand\tocgobble[1]{}% <- added
\newcommand\tocpageseparator{\footnotesize\,\mbox{---}\,}
\newcommand\tocpagenumberbox[1]{\mbox{#1}}
\KOMAoptions{toc=indentunnumbered}%indent only for section* !?

\RedeclareSectionCommands[
  tocraggedpagenumber,
  toclinefill=\tocpageseparator,
  tocindent=0em,
  tocnumwidth=4em,
  tocpagenumberbox=\tocpagenumberbox
]{chapter,section,subsection,subsubsection,paragraph}

\RedeclareSectionCommand[
  tocentryformat=\large\scshape,
  tocindent=0em,
  tocnumwidth=4em,
  tocpagenumberbox=\tocgobble
]{part}

\RedeclareSectionCommand[%
  tocentryformat=\textbf%
]{chapter}

\makeindex[
  intoc,
  name=loc, 
  title={Locations},
  columns=3,
  ]
\indexsetup{%
  level=\section*,
  toclevel=section,
  noclearpage,
  firstpagestyle=scrheadings,
  headers={\indexname}{\indexname},
    }
\begin{document}
  \nocite{*}
  \frontmatter
  \tableofcontents
  \mainmatter
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \setcounter{page}{100}
  \part{part}
  \chapter{chapter chapter}
  \section{section section section}  \section{section section section}  \section{section section section}
  \backmatter

  \part{part}
\index[loc]{A location}
  \chapter*{Abbildungs-, Tabellen-, Tafelverzeichnis}
  \addcontentsline{toc}{chapter}{Abbildungs-, Tabellen-, Tafelverzeichnis}
  \listoffigures
  \chapter*{\bibname}
  \addcontentsline{toc}{chapter}{\bibname}
  \printbiblist[%
      heading=subbibintoc,%
    title={Zeitschriftenabkürzungen}]{shortjournal}
  \printbiblist[%
    heading=subbibintoc,%
    title={Reihenabkürzungen}]{shortseries}
  \printbibliography[heading=subbibintoc]
\chapter*{Indizes}
\addcontentsline{toc}{chapter}{Indizes}
\printindex[loc]
\end{document}
1
  • Have you thought about using the right commands? You apparently have not read the KOMA documentation -> \addchap{Indizes}.
    – Johannes_B
    Feb 25, 2018 at 8:26

1 Answer 1

3

Your claim is wrong. You are just using the wrong commands.

lukasKomaIndentunnumbered

\documentclass[ngerman,twoside=false,listof=totoc,listof=leveldown]{scrbook}
\usepackage{imakeidx}
\KOMAoptions{toc=indentunnumbered}%indent only for section* !?
\makeindex[
  name=loc, 
  title={Locations},
  columns=3,
  ]
\indexsetup{%
  level=\addsec,
  noclearpage,
  headers={\indexname}{\indexname},
    }
\begin{document}
  \tableofcontents
\chapter{Wombat}
\index[loc]{A location}
\section{Walter}
\addchap{Capybara}
\addsec{Carl}
\chapter*{Lion}
\addcontentsline{toc}{chapter}{Lion}% Not the KOMA way
\section*{Laura}
\addcontentsline{toc}{section}{Laura}% Not the KOMA way
\addchap{Indizes}
\printindex[loc]
\end{document}

Note, that the \add<level> commands are only defined for part, chapter and section level.

The section commands of all KOMA-Script classes uses command \addxcontentsline (provided by package tocbasic) instead of \addcontentsline. The macro \addxcontentsline knows an additional optional argument:

\addxcontentsline{<extension>}{<level>}[<number>]{<text>}

Option toc=indentunnumbered requires the usage \addxcontentsline!

\documentclass{scrbook}
\KOMAoptions{toc=indentunnumbered}
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{A section}
\subsection{A subsection}

\addchap{Unnumbered chapter}
\addsec{Unnumbered section}
\subsection*{Unnumbered subsection%
  \addxcontentsline{toc}{subsection}{Unnumbered section}%
}

\end{document}

enter image description here

5
  • Ok, I can adjust chapter and section with \addchap/addsec, but it won’t work with makeindex. Any idea for that? Feb 25, 2018 at 9:46
  • @LukasCB Please adjust the minimal working example in your question to produce an index.
    – Johannes_B
    Feb 25, 2018 at 9:50
  • it is! isn’t it? Feb 25, 2018 at 9:50
  • @LukasCB Yes, sorry. Your example is far to complex. But i still don't see, why it wouldn't work with makeindex?
    – Johannes_B
    Feb 25, 2018 at 10:12
  • I found my error - havn’t thinking of level=\addsec etc. Thanks for helping! Feb 25, 2018 at 10:15

You must log in to answer this question.

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