首页 > 解决方案 > 如何在每章的前面创建一个目录,列出该章的内容?

问题描述

我正在处理一个包含多个作品的文档,并且需要能够为每个作品创建一个新的目录。我该如何做到这一点?需要明确的是,不同的作品是部分,所以我需要一个目录来容纳当前部分的所有子和子小节等。

这是一个例子

\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}


这是我正在使用的格式

标签: latextableofcontents

解决方案


etoc使用该软件包的一种可能性:

\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}

在此处输入图像描述


推荐阅读