我希望每个部分都有部分目录(迷你目录)。我希望使用包来实现这一点titletoc
。从下面的代码中可以看到,它基本上可以完成工作,但问题是,开头的主目录的设置不一定适用于迷你目录。例如,迷你目录像主目录的相应子目录一样缩进——当然这不是我们想要的……我希望它像章节标题一样左对齐。另一个问题是,对于迷你目录,我希望子部分条目之间有更多空间(但子子部分条目之间没有空间)。我该怎么做?正如您所见,第一个问题可以通过环境解决addmargin
(虽然有点丑陋),但我不知道如何解决第二个问题(调整迷你目录中子部分条目之间的空间)。
\documentclass[
paper=128mm:96mm]{scrartcl}
\linespread{1.12}
% font stuff
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[american]{babel}
% page structure
\usepackage{calc}
\usepackage[includefoot,top=5.5mm,bottom=4.5mm,left=5.5mm,right=5.5mm,footskip=4mm]{geometry}
\usepackage{scrpage2}
\usepackage{titlesec}
\usepackage{titletoc}
%%% settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% page style and layout
\pagestyle{scrheadings}
\clearscrheadfoot
% enlarge font sizes of headings by two levels
\addtokomafont{section}{\huge}
\addtokomafont{subsection}{\LARGE}
\addtokomafont{subsubsection}{\Large}
% spacings
\titlespacing{\section}{0mm}{0ex plus 1ex minus .2ex}{0ex plus .2ex}
\titlespacing{\subsection}{0mm}{0ex plus 1ex minus .2ex}{-.2ex plus .2ex}
\titlespacing{\subsubsection}{0mm}{0ex plus 1ex minus .2ex}{-.4ex plus .2ex}
\setcounter{secnumdepth}{3}% add numbering down to subsubsection
% table of contents
\AtBeginDocument{\renewcaptionname{american}{\contentsname}{\hspace{-0.08em}\Large Outline}}% change name of toc
\setcounter{tocdepth}{3}
\titlecontents{section}[1.2em]{\addvspace{0.6em}\bfseries}{\contentslabel{1.2em}}{\hspace*{-1.2em}}{}[]% define format for section of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{subsection}[3em]{}{\contentslabel{1.8em}}{\hspace*{-1.8em}}{}[]% define format for subsection of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{subsubsection}[5.6em]{}{\contentslabel{2.6em}}{\hspace*{-2.6em}}{}[]% define format for subsubsection of toc; entries: section, left, above, before with label, before without label, filler and page, after
%%% document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\clearpage
\section{Section 1}
\startcontents[]% kind
%\begin{addmargin}{-1.08em}% ugly but solves the first problem
\printcontents[]{}{2}{}% kind, prefix, top, init-code
%\end{addmargin}
\clearpage
\subsection{Subsection 1.1}
\subsubsection{Subsubsection 1.1.1}
\subsection{Subsection 1.2}
\section{Section 2}
\subsection{Subsection 2.1}
\subsubsection{Subsubsection 2.1.1}
\subsubsection{Subsubsection 2.1.2}
\subsection{Subsection 2.2}
\subsubsection{Subsubsection 2.2.1}
\subsubsection{Subsubsection 2.2.2}
\clearpage
\end{document}
答案1
对于“部分”目录,使用来定义文档正文中的\titlecontents
格式psubsection
和psubsubsection
(注意前缀)和问题。有关详细信息,请参阅/文档的第 17 页。\printcontents[]{p}{2}{}
titlesec
titletoc
\documentclass[
paper=128mm:96mm]{scrartcl}
\linespread{1.12}
% font stuff
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[american]{babel}
% page structure
\usepackage{calc}
\usepackage[includefoot,top=5.5mm,bottom=4.5mm,left=5.5mm,right=5.5mm,footskip=4mm]{geometry}
\usepackage{scrpage2}
\usepackage{titlesec}
\usepackage{titletoc}
%%% settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% page style and layout
\pagestyle{scrheadings}
\clearscrheadfoot
% enlarge font sizes of headings by two levels
\addtokomafont{section}{\huge}
\addtokomafont{subsection}{\LARGE}
\addtokomafont{subsubsection}{\Large}
% spacings
\titlespacing{\section}{0mm}{0ex plus 1ex minus .2ex}{0ex plus .2ex}
\titlespacing{\subsection}{0mm}{0ex plus 1ex minus .2ex}{-.2ex plus .2ex}
\titlespacing{\subsubsection}{0mm}{0ex plus 1ex minus .2ex}{-.4ex plus .2ex}
\setcounter{secnumdepth}{3}% add numbering down to subsubsection
% table of contents
\AtBeginDocument{\renewcaptionname{american}{\contentsname}{\hspace{-0.08em}\Large Outline}}% change name of toc
\setcounter{tocdepth}{3}
\titlecontents{section}[1.2em]{\addvspace{0.6em}\bfseries}{\contentslabel{1.2em}}{\hspace*{-1.2em}}{}[]% define format for section of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{subsection}[3em]{}{\contentslabel{1.8em}}{\hspace*{-1.8em}}{}[]% define format for subsection of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{subsubsection}[5.6em]{}{\contentslabel{2.6em}}{\hspace*{-2.6em}}{}[]% define format for subsubsection of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{psubsection}[1.8em]{\addvspace{0.6em}}{\contentslabel{1.8em}}{\hspace*{-1.8em}}{}[]% define format for section of toc; entries: section, left, above, before with label, before without label, filler and page, after
\titlecontents{psubsubsection}[4.4em]{}{\contentslabel{2.6em}}{\hspace*{-2.6em}}{}[]% define format for subsection of toc; entries: section, left, above, before with label, before without label, filler and page, after
%%% document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\clearpage
\section{Section 1}
\startcontents[]% kind
\printcontents[]{p}{2}{}% kind, prefix, top, init-code
\clearpage
\subsection{Subsection 1.1}
\subsubsection{Subsubsection 1.1.1}
\subsection{Subsection 1.2}
\section{Section 2}
\subsection{Subsection 2.1}
\subsubsection{Subsubsection 2.1.1}
\subsubsection{Subsubsection 2.1.2}
\subsection{Subsection 2.2}
\subsubsection{Subsubsection 2.2.1}
\subsubsection{Subsubsection 2.2.2}
\clearpage
\end{document}