![仅附录的目录 (scrartcl)](https://linux22.com/image/412300/%E4%BB%85%E9%99%84%E5%BD%95%E7%9A%84%E7%9B%AE%E5%BD%95%20(scrartcl).png)
使用minitoc
包中的scrartcl
我想仅为附录及其内容创建目录。我的代码运行,但我无法仅为附录的内容在附录中创建目录。最小示例:
\documentclass[]{scrartcl}
\KOMAoption{listof}{totoc}
\usepackage{minitoc}
\begin{document}
\dosecttoc
\tableofcontents
\section{Hello}
\appendix
\section{Appendix}
\secttoc
\dosecttoc
\end{document}
答案1
附录中没有子节。如果我添加子节,则会在附录中得到目录:
例子:
\documentclass[]{scrartcl}
\KOMAoption{listof}{totoc}
\usepackage{minitoc}
\begin{document}
\dosecttoc
\tableofcontents
\section{Hello}
\appendix
\section{Appendix}
\secttoc
\dosecttoc
\subsection{Foo}% <- added
\subsection{Bar}% <- added
\KOMAScriptVersion
\end{document}
但不建议将该包minito
与KOMA-Script 类一起使用。
建议在主目录中仅包含“附录”:
\documentclass{scrartcl}
\KOMAoption{listof}{totoc}
\DeclareNewTOC[%
owner=\jobname,
listname={\contentsname},
setup=leveldown
]{atoc}
\makeatletter
\newcommand*{\useatocs}{%
\renewcommand*{\ext@toc}{atoc}%
\scr@ifundefinedorrelax{hypersetup}{}{% maybe you use hyperref and bookmarks
\hypersetup{bookmarkstype=atoc}%
}%
}
\makeatother
\begin{document}
\tableofcontents
\section{Hello}
\appendix
\section{Appendix}
\useatocs
\listofatocs
\subsection{Foo}
\subsection{Barg}
\end{document}
包含完整主要目录的建议:
\documentclass{scrartcl}
\KOMAoption{listof}{totoc}
\usepackage{scrwfile}
\TOCclone[{\contentsname}]{toc}{atoc}
\setuptoc{atoc}{leveldown}
\addtocontents{atoc}{\protect\value{tocdepth}=-2}
\newcommand*{\useatoc}{%
\addtocontents{atoc}{\protect\value{tocdepth}=\subsubsectiontocdepth}%
}
\begin{document}
\tableofcontents
\section{Hello}
\appendix
\section{Appendix}
\useatoc
\listofatoc
\subsection{Foo}
\subsection{Bar}
\end{document}
答案2
所以,解决方案来了。而不是minitoc
使用titletoc
,事情就会好起来:
\documentclass[]{scrartcl}
\usepackage{titletoc}
\newcommand\DoToC{%
\startcontents
\printcontents{}{2}{\textbf{Contents}\vskip3pt\hrule\vskip5pt}
\vskip3pt\hrule\vskip5pt
}
\begin{document}
\section{Hello}
\newpage
\appendix
\section{Appendix}
\DoToC
\subsection{goodnight}
\subsection{goodmourning}
\end{document}
放置以下物品很重要:
%toc for appendix only:
\usepackage{titletoc}
\newcommand\DoToC{%
\startcontents
\printcontents{}{2}{\textbf{Contents}\vskip3pt\hrule\vskip5pt}
\vskip3pt\hrule\vskip5pt
}
否则{scrartcl}
,目录将包含放错位置toc
的