1

The section title in the list of Appendices is not being indented, but the subsection title is indented. So, for example, the outline of Appendices in my table of contents looks like this:

APPENDICES

    A     Chapter Title

    B     Chapter Title

    B.1     Section Title

    B.2     Section Title

                B.2.1     Subsection Title

                B.2.2     Subsection Title

    C     Chapter Title

    C.1     Section Title

    C.2     Section Title

    C.3     Section Title

I don't really have any special code, I don't think. I need it to look like this:

APPENDICES

    A     Chapter Title

    B     Chapter Title

             B.1     Section Title

             B.2     Section Title

                         B.2.1     Subsection Title

                         B.2.2     Subsection Title

    C     Chapter Title

             C.1     Section Title

             C.2     Section Title

             C.3     Section Title

What can I do? Thank you in advance for your help.

The code I used is from this template:

\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}
4
  • 1
    Perhaps you do have some special code but how could we tell as you have shown no code at all. We have no ide what you have done, not even what class you are using. Please provide an MWE (from \documentclass... to \end{document}) that we can compile and which shows your problem. --- GOM Jul 28, 2022 at 17:24
  • Sorry about that! I used the code from this template here at this link: github.com/CalPolyCSC/thesis-template/blob/master/main.tex
    – Elaine
    Aug 1, 2022 at 2:35
  • 1
    I don't follow links; they can disappear over time. You have still shown no code. Aug 2, 2022 at 18:07
  • Hi @PeterWilson thank you for your patience. I added the main.tex code in the main post above. Could you please take a look. Thank you!!
    – Elaine
    Aug 2, 2022 at 23:17

1 Answer 1

0

I fixed it! I removed this:

{\let\protect\l@chapter\protect\l@section}

from this line in the code:

\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}

and that fixed my problem.

1
  • This should be posted as a comment rather than an answer.
    – itc
    Aug 5, 2022 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .