latex - 如何在每章的前面创建一个目录,列出该章的内容?
问题描述
我正在处理一个包含多个作品的文档,并且需要能够为每个作品创建一个新的目录。我该如何做到这一点?需要明确的是,不同的作品是部分,所以我需要一个目录来容纳当前部分的所有子和子小节等。
这是一个例子
\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}
推荐阅读
- mysql - 从 MySQL 表中选择随机查询
- ios - XCode 10、Cocoapods 和新构建系统存档失败
- android - Android - 如何在 AppBarLayout 中添加谷歌地图?
- php - 日期时间没有使用格式函数给出正确的值
- qt - 渲染到一个 FBO 会破坏另一个 FBO
- image - 如何在flutter中使用rootBundle加载图片?
- python - JSONDecodeError:预期值:读取 Json 文件时的第 1 行第 1 列(字符 0)
- python - CTRL+C中断所有线程
- c++ - 如何将此 curl 命令转换为 libcurl
- javascript - 如何为每个活动滑块启动动画