![目录 缩进 章节 过去部分](https://linux22.com/image/330504/%E7%9B%AE%E5%BD%95%20%E7%BC%A9%E8%BF%9B%20%E7%AB%A0%E8%8A%82%20%E8%BF%87%E5%8E%BB%E9%83%A8%E5%88%86.png)
我想弄清楚如何将目录中的章节缩进部分标题之后。我想这样做以提高可读性。这是我的文档在 main.tex 中的布局方式
\documentclass[oneside,11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}
% include title and author information for the cover
\input{components/info}
% include settings
\input{components/settings}
% include commands
\input{components/commands}
\makeglossaries
\begin{document}
\frontmatter
\input{components/titlepage}
\input{components/disclaimer}
\input{components/acknowledgements}
\input{components/abstract}
\tableofcontents
\mainmatter
\part[Introduction and Requirements Gathering]{Introduction and Requirements Gathering}
\label{part:introAndRequirementsGathering}
\input{chapters/Introduction}
\input{chapters/PartsTraceabilityProcess}
\input{chapters/ProblemStatement}
\input{chapters/ITInfrastructure}
\part[Target Concept]{Target Concept}
\label{part:targetConcept}
\input{chapters/DataModelDesign}
\input{chapters/PotentialSolutionsAndComparison}
\input{chapters/RecommendedSolution}
\part*{Appendix}
\addcontentsline{toc}{part}{Appendix}
\appendix %---------------------------------------
\input{chapters/CodeAppendix}
\input{chapters/HadoopPlatformAppendix}
\clearemptydoublepage
\nocite{*}
\printglossaries
\bibliography{bibliography/literature}
\end{document}
我的 setting.tex 文件包括以下内容:
% Included by MAIN.TEX
\renewcommand{\sectfont}{\normalfont \bfseries} % Schriftart der Kopfzeile
% manipulate footer
\usepackage{scrpage2}
\pagestyle{scrheadings}
\ifoot[\footertext]{\footertext} % \footertext set in INFO.TEX
%\setkomafont{pagehead}{\normalfont\rmfamily}
\setkomafont{pagenumber}{\normalfont\rmfamily}
%% allow sophisticated control structures
\usepackage{ifthen}
% use Palatino as default font
\usepackage{palatino}
% enable special PostScript fonts
\usepackage{pifont}
% make thumbnails
\usepackage{thumbpdf}
\usepackage{caption}
\usepackage{subcaption}
% make algorithms
\usepackage[ruled,vlined]{algorithm2e}
% insert code snippets
\usepackage{listings}
% create glossaries
\usepackage[nomain,acronym,xindy,toc]{glossaries}
\renewcommand{\lstlistingname}{Code Snippet}% Listing -> Code Snippet
\usepackage{colortbl}
%% use better tabular package
\usepackage{tabularx}
% for drawing trees
\usepackage{qtree}
% for making single pages landscape
\usepackage{lscape}
% Include the listings-package
\usepackage{listings}
\lstset{breaklines=true,basicstyle={\footnotesize},showstringspaces=false,captionpos=b,frame=single}
\usepackage{multirow}
%% use colors
\usepackage{color}
%% make fancy math
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{yhmath} % fr die adots
%% create an index
\usepackage{makeidx}
% for the program environment
\usepackage{float}
%% load german babel package for german abstract
\usepackage[german,english]{babel}
\selectlanguage{english}
% use german characters as well
\usepackage[latin1]{inputenc} % allow Latin1 characters
\usepackage{styles/shortoverview}
%----------------------------------------------------
% Graphics and Hyperlinks
%----------------------------------------------------
%% check for pdfTeX
\ifx\pdftexversion\undefined
%% use PostScript graphics
\usepackage[demo]{graphicx}
\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps,.epsi}
\graphicspath{{figures/}{figures/review}}
%% allow rotations
\usepackage{rotating}
%% use hypertex version of hyperref
\usepackage[hypertex,hyperindex=false,colorlinks=false]{hyperref}
\else %% reduce output size \pdfcompresslevel=9
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.jpg,.JPG,.png,.pdf,.eps}
\graphicspath{{figures/}}
%% Load float package, for enabling floating extensions
\usepackage{float}
%% allow rotations
\usepackage{rotating}
%% use pdftex version of hyperref
\usepackage[pdftex,colorlinks=true,linkcolor=black,citecolor=black,%
anchorcolor=black,urlcolor=black,bookmarks=true,%
bookmarksopen=true,bookmarksopenlevel=0,plainpages=false%
bookmarksnumbered=true,hyperindex=false,pdfstartview=%
]{hyperref}
\fi
\usepackage{setspace}
\doublespacing
%\onehalfspacing
% Use for building tree structures
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,arrows}
\usepackage{tikz-dependency}
\usepackage[export]{adjustbox}
\tikzstyle{cloud} = [draw, ellipse,fill=blue!20, node distance=3cm,minimum height=2em]
\tikzstyle{line} = [draw, -latex']
%% Fancy chapters
\usepackage[Lenny]{fncychap}
% set the bibliography style
\bibliographystyle{plain}
抱歉,我可能包含了太多信息。我是 LaTeX 新手,正在使用部门的模板,所以我不确定哪些信息相关,哪些不相关。
我阅读了这些 StackExchange 问题来寻找解决我的问题的方法,但它们似乎并不能满足我的需求:
缩进回忆录中的章节标题
如何在目录中缩进章节标题(回忆录类)
将目录部分缩进应用于章节
感谢您的帮助,如果您需要任何其他信息,请告诉我。
答案1
使用 KOMA-Script 类,您可以重新定义\addchaptertocentry
仅缩进目录中的编号章节。
\documentclass[
oneside,
bibliography=totoc,% <- changed
index=totoc,% <- changed
headsepline,footsepline,
footinclude=false,% <- changed
BCOR=12mm,% <- changed
DIV=13,% <- changed
]{scrbook}
\addtokomafont{disposition}{\rmfamily}
\RedeclareSectionCommand[tocnumwidth=3.5em]{chapter}
\renewcommand\addchaptertocentry[2]{%
\ifstr{#1}{}{%
\addtocentrydefault{chapter}{#1}{#2}%
}{%
\addtocentrydefault{chapter}{\hspace*{2em}#1}{#2}%
}}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Acknowlodgements}
\chapter{Abstract}
\mainmatter
\part[Introduction and Requirements Gathering]{Introduction and Requirements Gathering}
\chapter{Chapter One}
\KOMAScriptVersion
\chapter{Chapter Two}
\end{document}
结果: