我想缩进目录的章节行(包括部分和章节)但显然我无法做到这一点。
我知道我使用的 Koma-script (scrbook) 默认应该会这样做,但实际上却没有。我阅读了手册和论坛上的几个问题。显然可以使用 toc=graduated 或 toc=indent 选项。我尝试将该选项放在 documentclass 中,但不起作用。
有人能帮助我吗?
这是我的代码:
\documentclass[chapterprefix=true]{scrbook}
\setcounter{secnumdepth}{0}
\usepackage{xcolor, graphicx}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{textcomp}
\usepackage{indentfirst}
\usepackage{times}
\usepackage{mathptmx}
\usepackage{setspace}
\doublespacing
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}
\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
%\setkomafont{element}{commands}
\setkomafont{title}{\color{cyan}\LARGE}
\setkomafont{chapter}{\color{cyan}\LARGE}
\setkomafont{subtitle}{\color{black}}
\renewcommand*{\chapterformat}{%
\scalebox{3}{\color{cyan}\thechapter}%
}
\begin{document}
\author{}
\subject{Linea Guida}
\title{\textbf{Il trattamento laparoscopico di laparocele e ernie ventrali}}
\subtitle{}
\titlehead{}
\date{Gennaio 2022}
\frontmatter
\maketitle
\tableofcontents
\chapter{Intro}
\mainmatter
\part{Sviluppo della linea guida}
\chapter{one}
\chapter{two}
\part{Quesiti}
\chapter{three}
\chapter{four}
\backmatter
% bibliography, glossary and index would go here.
\end{document}
答案1
每个分段命令都有一个所谓的depth
,例如 为 -1 \part
, 为 为 0 \chapter
, 为 为 1\section
等等。缩进仅以 开头\section
。由于您只定义了\chapter
,因此您的所有条目均未缩进。
添加几个额外的级别会产生预期的结果
\documentclass[chapterprefix=true]{scrbook}
\setcounter{secnumdepth}{0}
\usepackage{xcolor, graphicx}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{textcomp}
\usepackage{indentfirst}
\usepackage{times}
\usepackage{mathptmx}
\usepackage{setspace}
\doublespacing
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}
\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
%\setkomafont{element}{commands}
\setkomafont{title}{\color{cyan}\LARGE}
\setkomafont{chapter}{\color{cyan}\LARGE}
\setkomafont{subtitle}{\color{black}}
\renewcommand*{\chapterformat}{%
\scalebox{3}{\color{cyan}\thechapter}%
}
\begin{document}
\author{}
\subject{Linea Guida}
\title{\textbf{Il trattamento laparoscopico di laparocele e ernie ventrali}}
\subtitle{}
\titlehead{}
\date{Gennaio 2022}
\frontmatter
\maketitle
\tableofcontents
\chapter{Intro}
\mainmatter
\part{Sviluppo della linea guida}
\chapter{one (depth=0)}
\section{First section (depth=1)}
\subsection{A subsection (depth=2)}
% The subsubsection does not appear in the toc, because the default is tocdepth=2 for scrbook
\subsubsection{And a subsubsection (depth=3)}
\section{Second section}
\chapter{two}
\part{Quesiti}
\chapter{three}
\chapter{four}
\backmatter
% bibliography, glossary and index would go here.
\end{document}
和\section
和\subsection
未编号,因为您指定了\setcounter{secnumdepth}{0}
,含义只有\part
和\chapter
有编号。
另外,请注意,\subsubsection
目录中没有出现。这是通过计数器控制的,该计数器的tocdepth
默认值为。2
scrbook
Koma-Script 有一些方便的命令,所以您不必记住不同的深度。添加\setcounter{tocdepth}{\subsubsectiontocdepth}
将包含\subsubsection
在目录中。
如果您希望您的章节等缩进,您可以将其添加到您的序言中one
。two
\RedeclareSectionCommand[
tocindent=2em
]{chapter}
\RedeclareSectionCommand[
tocindent=4em
]{section}
\RedeclareSectionCommand[
tocindent=6em
]{subsection}