微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在每个章节的前面创建一个目录,列出该章节的内容?

如何解决如何在每个章节的前面创建一个目录,列出该章节的内容?

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

这是一个例子

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


这是我使用的格式

解决方法

使用 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}

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。