I am working on a document with multiple works in it and need to be able to create a new tableofcontents per work. How do I achieve that? To be clear, the diffrent works are sections, so I need a tableofcontents that shoes all sub- and subsubsections etc of the current section.
Here is an example
\documentclass[paper=170mm:240mm,BCOR=5mm,DIV=calc,10pt,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[hyphens]{url}
\usepackage{blindtext}
\usepackage[onehalfspacing]{setspace}
\usepackage{pdfpages}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{backgrounds,calc}
\setquotestyle[guillemets]{german}
\usepackage[symbol,hang]{footmisc}
%package für Abkürzungsverzeichnis
\usepackage[]{acronym}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\headmark}
\automark[subsection]{section}
\ofoot[\pagemark]{\pagemark}
\usepackage[fleqn]{amsmath}
\usepackage{xcolor}
\usepackage{imakeidx}
\makeindex[program=makeindex,options=-s MyIndex,columns=2,title=Sachregister,intoc]
% Use package for title formatting
\usepackage{titlesec}
\usepackage{float}
% Make title page
%Hier Set und Def von Sachen-----------------------------------------
% Strich bei Seitenzahlen:------------------
\rofoot*{%
\makebox[0pt][l]{%
\hspace{\marginparsep}%
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\enskip
\pagemark
}%
}
\lefoot*{%
\makebox[0pt][r]{%
\pagemark
\enskip
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\hspace{\marginparsep}%
}%
}
\addtokomafont{pagehead}{\upshape}
%---------------------------------------------
\title{a}
\author{b }
\date{April 2021}
%Dokument-----------------------------------------------------------
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\Blinddocument
\end{document}
This is the format I'm using
One possibility using the etoc
package:
\documentclass[paper=170mm:240mm,BCOR=5mm,DIV=calc,10pt,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[hyphens]{url}
\usepackage{blindtext}
\usepackage[onehalfspacing]{setspace}
\usepackage{pdfpages}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{backgrounds,calc}
\setquotestyle[guillemets]{german}
\usepackage[symbol,hang]{footmisc}
%package für Abkürzungsverzeichnis
\usepackage[]{acronym}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\headmark}
\automark[subsection]{section}
\ofoot[\pagemark]{\pagemark}
\usepackage[fleqn]{amsmath}
\usepackage{xcolor}
\usepackage{imakeidx}
\makeindex[program=makeindex,options=-s MyIndex,columns=2,title=Sachregister,intoc]
% Use package for title formatting
%\usepackage{titlesec}
\usepackage{float}
% Make title page
%Hier Set und Def von Sachen-----------------------------------------
% Strich bei Seitenzahlen:------------------
\rofoot*{%
\makebox[0pt][l]{%
\hspace{\marginparsep}%
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\enskip
\pagemark
}%
}
\lefoot*{%
\makebox[0pt][r]{%
\pagemark
\enskip
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\hspace{\marginparsep}%
}%
}
\addtokomafont{pagehead}{\upshape}
%---------------------------------------------
\title{a}
\author{b }
\date{April 2021}
\usepackage{etoc}
\etocsettocstyle{}{}%
%Dokument-----------------------------------------------------------
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{First Chapter}
\localtableofcontents
\section{title}
\section{title}
\blindtext
\end{document}