2

I have an annoying issue that I have not been able to fix. I have a custom document class file from my university I'm using to format my thesis. The problem is the alignment in the table of contents. For chapter titles that go over a single line, the alignment switches to centered and I can't figure out a way to force the title to remain left justified. Here is a picture:

enter image description here

I have pasted the class file below. I would be so happy if someone could tell me how to edit this darn file to force the titles to remain left justified. I am assuming I should make an edit to the class file, rather than the build file, but I'm not sure. Any help would be MUCH appreciated. This has been bothering me for a while.. and my thesis is due soon! :-P

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ucithesis}[2012/10/10 UCI Thesis class]
\LoadClassWithOptions{report}
\RequirePackage[hmargin={1in,1in},vmargin={1in,1in}]{geometry}
\RequirePackage{setspace}
\newcommand{\thesistitle}[1]{\newcommand\Thesistitle{#1}}
\newcommand{\degreename}[1]{\newcommand\Degreename{#1}}
\newcommand{\degreefield}[1]{\newcommand\Degreefield{#1}}
\newcommand{\authorname}[1]{\newcommand\Authorname{#1}}
\newcommand{\degreeyear}[1]{\newcommand\Degreeyear{#1}}
\newcommand{\committeechair}[1]{\newcommand\Committeechair{#1}}
\newcommand{\othercommitteemembers}[1] 
{\newcommand\Othercommitteemembers{#1}}
\newcommand{\copyrightdeclaration}[1]{\newcommand\Copyrightdeclaration{#1}}
\newcommand{\prepublishedcopyrightdeclaration}[1] 
{\newcommand\Prepublishedcopyrightdeclaration{#1}}
\newcommand{\dedications}[1]{\newcommand\Dedications{#1}}
\newcommand{\acknowledgments}[1]{\newcommand\Acknowledgments{#1}}
\newcommand{\curriculumvitae}[1]{\newcommand\Curriculumvitae{#1}}
\newcommand{\thesisabstract}[1]{\newcommand\Thesisbstract{#1}}
\newcommand{\thesistitlepage}
{
\vspace*{0.5in}
\thispagestyle{empty}
\singlespacing
\begin{center}
    UNIVERSITY OF CALIFORNIA, \\
    IRVINE \\
    \vspace{0.4in}
    \Thesistitle \\
    \vspace{0.15in}
    DISSERTATION \\
    \vspace{0.4in}
    submitted in partial satisfaction of the requirements \\
    for the degree of \\
    \vspace{0.4in}
    \MakeUppercase\Degreename \\
    \vspace{0.15in}
    in \Degreefield \\
    \vspace{0.4in}
    by \\
    \vspace{0.4in}
    \Authorname \\
\end{center}
\vspace{1in}
\begin{flushright}
    Dissertation Committee: \\
    \Committeechair, Chair \\
    \Othercommitteemembers \\
\end{flushright}
\vfill
\begin{center}
    \Degreeyear
\end{center}
\clearpage
}
\newcommand{\copyrightpage}
{
\thispagestyle{empty}
\rule{0in}{0in}
\protect\vfill
\begin{center}
\Copyrightdeclaration
\end{center}
\clearpage
}
\newcommand{\prepublishedcopyrightpage}
{
\thispagestyle{empty}
\rule{0in}{0in}
\protect\vfill
\begin{center}
    \Prepublishedcopyrightdeclaration
\end{center}
\clearpage
}
\newcommand{\signaturepage}
{
\vspace*{1in}
\begin{center}
    The dissertation of \Authorname \\
    is approved and is acceptable in quality and form for \\
    publication on microfilm and in digital formats: \\
\end{center}
\vspace{3in}
\begin{flushright}
\rule{3in}{0.01in} \\
\vspace{0.4in}
\rule{3in}{0.01in} \\
\vspace{0.4in}
\rule{3in}{0.01in} \\
Committee Chair
\end{flushright}
\vspace{.75in}
\begin{center}
University of California, Irvine \\
\Degreeyear
\end{center}
\clearpage
}
\newcommand{\dedicationpage}
{
\begin{center}
    \textbf{\Large DEDICATION} \\
    \vspace{0.4in}
    \Dedications
\end{center}
\clearpage
}
\newcommand{\acknowledgmentspage}
{
\begin{center}
    \textbf{\Large ACKNOWLEDGMENTS}
\end{center}
\parskip 12pt
\parindent 0pt
\Acknowledgments
\clearpage
}
\newcommand{\curriculumvitaepage}
{
\begin{center}
    \textbf{\Large CURRICULUM VITAE} \\
    \vspace{0.4in}
    \textbf{\large{\Authorname}}
\end{center}
\Curriculumvitae
\clearpage
}
\newcommand{\abstractpage}
{
\begin{center}
    {\bf\Large ABSTRACT OF THE DISSERTATION} \\
    \vspace{0.2in}
    \Thesistitle \\
    \vspace{0.2in}
    By \\
    \vspace{0.2in}
    \Authorname \\
    \vspace{0.2in}
    \Degreename\ in \Degreefield \\
    \vspace{0.2in}
    University of California, Irvine, \Degreeyear \\
    \vspace{0.2in}
    \Committeechair, Chair \\
\end{center}
\vspace{0.2in}
\doublespacing
\Thesisbstract
\clearpage
}
\renewcommand{\contentsname}{\protect\centering\protect\Large TABLE OF 
CONTENTS}
\renewcommand{\listfigurename}{\protect\centering\protect\Large LIST OF 
FIGURES}
\renewcommand{\listtablename}{\protect\centering\protect\Large LIST OF 
TABLES}
\addtocontents{toc}{\protect\raggedleft Page\\}
\addtocontents{lof}{\protect\raggedleft Page\\}
\addtocontents{lot}{\protect\raggedleft Page\\}
\addtocontents{loa}{\protect\raggedleft Page\\}
\newcommand{\preliminarypages}
{
\pagenumbering{gobble}% Remove page numbers (and reset to 1), see 
 http://tex.stackexchange.com/questions/54333/no-page-numbering
\clearpage
\thispagestyle{empty}
\thesistitlepage
\clearpage
\pagenumbering{roman}
    \ifx\Prepublishedcopyrightdeclaration\undefined
  \copyrightpage
\else
  \prepublishedcopyrightpage
    \fi
\setcounter{page}{2}
%\signaturepage  %% not for electronic submission
    \ifx\Dedications\undefined
\else
  \dedicationpage
\fi
\begin{flushright}
\tableofcontents
\end{flushright}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\ifx\listalgorithmname\undefined  % for algorithm package
\else
  \clearpage
  \phantomsection
  \addcontentsline{toc}{chapter}{LIST OF ALGORITHMS}
  \listofalgorithms
\fi
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{ACKNOWLEDGMENTS}
\acknowledgmentspage
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{CURRICULUM VITAE}
\curriculumvitaepage
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{ABSTRACT OF THE DISSERTATION}
\abstractpage
\clearpage
\setcounter{page}{1}
\pagenumbering{arabic}
}
\newcommand{\myappendix}
{
\par
\setcounter{section}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\setcounter{equation}{0}
\gdef\thechapter{\@Alph\c@section}
\gdef\thesection{\@Alph\c@section}
\chapter*{Appendices}
\addcontentsline{toc}{chapter}{Appendices}
}
\renewcommand{\bibliography}[1]{%
\if@filesw
\immediate\write\@auxout{\string\bibdata{#1}}%
\fi

\addcontentsline{toc}{chapter}{Bibliography}
\begin{singlespacing}
\@input@{\jobname.bbl}
\end{singlespacing}
}
0

(Leaving this for future UCI grads who might experience a same issue.)

Yeah, it is indeed annoying. I spent a few hours on this, and came up with the following fix.

It is due to the chapter command defined in report.cls, the latex document class that ucithesis.cls is based on. Just removing one command (\advance) would fix the alignment problem. I recommend not to modify report.cls, but to use renewcommand. For example, the following lines can be added into ucithesis.cls:

\renewcommand*\l@chapter[2]{%
 \ifnum \c@tocdepth >\m@ne
  \addpenalty{-\@highpenalty}%
  \vskip 1.0em \@plus\p@
  \setlength\@tempdima{1.5em}%
  \begingroup
   \parindent \z@ \rightskip \@pnumwidth
   \parfillskip -\@pnumwidth
   \leavevmode \bfseries                
   %%% \advance\leftskip\@tempdima  %%% <--- Lose (or comment out) this line
   \leftskip\@tempdima              %%% <--- Add this line
   \hskip -\leftskip
   #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
   \penalty\@highpenalty
  \endgroup
 \fi}
0

Perhaps that is how it is meant to look. Before changing anything check with the appropriate University person/department.

Don't make any changes to the class file, keep them local to your thesis, e.g.,

\documentclass[...]{...}
local code changing class bits and pieces
\begin{document}

A quick fix is not to have long titles in the ToC by using the optional \chapter argument.

\chapter[Short title for ToC and Header]{Long title for the body}
  • I appreciate your tip! I am quite sure this is not how it's supposed to look. I can bring up UCI theses from recent years with lots of long chapter names, and there they are, nicely aligned.. I've tried slotting in various commands in the build file, like \begin{flushleft} \tableofcontents \end{flushleft}, but I can't get the thing to do what I want! – gregory_britten Apr 22 '18 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.