附录列表中的章节标题未缩进,但子章节标题是缩进。例如,我的目录中附录的大纲如下所示:
附录
章节标题
B 章节标题
B.1 章节标题
B.2 章节标题
B.2.1 小节标题
B.2.2 小节标题
C 章节标题
C.1 章节标题
C.2 章节标题
C.3 章节标题
我觉得我其实没有什么特别的代码。我需要它看起来像这样:
附录
章节标题
B 章节标题
B.1 章节标题
B.2 章节标题
B.2.1 小节标题
B.2.2 小节标题
C 章节标题
C.1 章节标题
C.2 章节标题
C.3 章节标题
我能做什么?提前感谢您的帮助。
我使用的代码来自此模板:
\documentclass[12pt]{ucthesis}
\usepackage{etex}
\usepackage[morefloats=125]{morefloats}
\usepackage[hyphens]{url}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[letterpaper]{geometry}
\usepackage[overload]{textcase}
\usepackage{color}
\usepackage[nonumberlist,toc]{glossaries}
\usepackage{wrapfig}
\usepackage{longtable}
\usepackage{morefloats}
\usepackage{float}
\usepackage{listings}
\usepackage{makecell}
\usepackage{appendix}
\usepackage[]{algorithm2e}
\usepackage{titlesec}
\usepackage[breaklinks=true,hidelinks,pdfusetitle]{hyperref}
\usepackage{cleveref}
\usepackage{ifthen}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
% Added to avoid windows and orphans
\usepackage[all]{nowidow}
% Added to fix spacing between footnote entries
\usepackage{setspace}
\newlength{\myfootnotesep}
\setlength{\myfootnotesep}{\baselineskip}
\addtolength{\myfootnotesep}{-\footnotesep}
\setlength{\footnotesep}{\myfootnotesep} % set spacing between footnotes
\makeindex
\makeglossaries
% Shrink the size of headers
\titleformat{\chapter}[display]
{\normalfont\normalsize\centering}
{\ifthenelse{\equal{\thechapter}{A}}{APPENDICES\\[4.3ex]}{}\chaptertitlename\ \thechapter}
{0pt}{\normalsize\uppercase}
\titlespacing*{\chapter}{0pt}{-20pt}{4.3ex plus .2ex}
\titleformat*{\section}{\normalsize\bfseries}
\titleformat*{\subsection}{\small\bfseries}
\titleformat*{\subsubsection}{\small\bfseries}
\titleformat*{\paragraph}{\small\bfseries}
\titleformat*{\subparagraph}{\small\bfseries}
\bibliographystyle{abbrv}
% Make \tindent indent pages if you have no paragraph indent
\newlength\tindent
\setlength{\tindent}{\parindent}
\setlength{\parindent}{0.in} \setlength{\parskip}{1.em}
\renewcommand{\indent}{\hspace*{\tindent}}
% Otherwise, comment out the above and uncomment this for default indentation on each paragraph
%\setlength{\parindent}{0.25in} \setlength{\parskip}{6pt}
\geometry{verbose,nohead,tmargin=1in,bmargin=1in,lmargin=1.5in,rmargin=1in}
% Different font in captions (single-spaced, bold) ------------
\newcommand{\captionfonts}{\small\bf\ssp}
\newcommand{\mycaption}[2]{\caption[#1 --- #2]{#1 --- #2}}
\makeatletter % Allow the use of @ in command names
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{{\captionfonts #1: #2}}%
\ifdim \wd\@tempboxa >\hsize
{\captionfonts #1: #2\par}
\else
\hbox to\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother % Cancel the effect of \makeatletter
% ---------------------------------------
% Define Appendix refs
\crefname{app}{appendix}{appendices}
\Crefname{app}{Appendix}{Appendices}
% Add Figures folder to the graphics path
\graphicspath{{Figures/}{figures/}}
% Options for hyperref
\hypersetup{
bookmarksnumbered=true,
bookmarksopen=false,
bookmarksopenlevel=0,
colorlinks=false,
pdfstartview=Fit,
pdfborder={0 0 0},
}
\newcounter{qcounter}
\providecommand{\keywords}[1]{\textbf{\textit{Keywords:}} #1}
\begin{document}
% Declarations for Front Matter
\input{frontmatter}
\maketitle
\begin{frontmatter}
% Custom made for Cal Poly (by Mark Barry, modified by Andrew Tsui).
\copyrightpage
% Custom made for Cal Poly (by Andrew Tsui).
\committeemembershippage
\begin{abstract}
\input{abstract}
\end{abstract}
\begin{acknowledgements}
\input{acknowledgements}
\end{acknowledgements}
\tableofcontents
\listoftables
\listoffigures
% Add CHAPTER into table of contents.
\addtocontents{toc}{%
\noindent CHAPTER
}
\end{frontmatter}
\pagestyle{plain}
\renewcommand{\baselinestretch}{1.66}
\input{chapter-outline}
\nocite{*}
\bibliography{bibliography}
% Indents Appendix in Table of Contents
\makeatletter
\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}
\makeatother
% Hack to make Appendices to appear in Table of Contents
\addtocontents{toc}{%
\noindent APPENDICES
}
\begin{appendices}
\input{appendix-outline}
\end{appendices}
\end{document}
答案1
我修复了它!我删除了以下内容:
{\let\protect\l@chapter\protect\l@section}
从代码中的这一行:
\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}
这解决了我的问题。