[Tex/LaTex] Upper case chapter titles, sections, subsections, list of tables and figures in the table of contents

table of contents

I used the resources here and it worked for me but still have errors on the list of tables and figures: Upper case chapter titles in the table of contents?. I am using a document class prepared by D. Leif Anderson \documentclass[nosmallcaps,toccaps,12pt]{csuthesis}.

My modification:

\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
    \thispagestyle{plain}%
    \global\@topnum\z@
    \@afterindentfalse
    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \refstepcounter{chapter}%
    \typeout{\@chapapp\space\thechapter.}%
    \addcontentsline{toc}{chapter}%
    {\protect\numberline{\thechapter}\MakeUppercase{#1}}%   
    \fi}
\makeatother

\makeatletter
\renewcommand\section{\if@openright\cleardoublepage\else\clearpage\fi
    \thispagestyle{plain}%
    \global\@topnum\z@
    \@afterindentfalse
    \secdef\@section\@section}
\def\@section[#1]#2{\ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \refstepcounter{section}%
    \typeout{\@secapp\space\thesection.}%
    \addcontentsline{toc}{section}%
    {\protect\numberline{\thesection}\MakeUppercase{#2}}%   
    \fi}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand\subsection{\if@openright\cleardoublepage\else\clearpage\fi
    \thispagestyle{plain}%
    \global\@topnum\z@
    \@afterindentfalse
    \secdef\@subsection\@subsection}
\def\@subsection[#1]#2#3{\ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \refstepcounter{subsection}%
    \typeout{\@subsecapp\space\thesubsection.}%
    \addcontentsline{toc}{subsection}%
    {\protect\numberline{\thesubsection}\MakeUppercase{#3}}%    
    \fi}
\makeatother

Your help is a lot appreciated…

Best Answer

DISCLAIMER: The following answer only makes sense in this particular case (if at all), with the double-patched document class csuthesis.cls. The lines below are workarounds for workarounds for ...

\documentclass[12pt]{csuthesis}
\usepackage{xpatch}
\xpatchcmd\maketitle{\scshape Abstract}{ABSTRACT}{}{}
\xpatchcmd\maketitle{\scshape Acknowledgements}{ACKNOWLEDGEMENTS}{}{}
\makeatletter
\setcounter{tocdepth}{3}
\renewcommand{\tocsection}[3]%
  {\indentlabel{\@ifnotempty{#2}{\MakeUppercase{\ignorespaces#1} #2.\quad}}%
   \MakeUppercase{#3}%
  }
\renewcommand{\tocappendix}[3]%
  {\indentlabel{\MakeUppercase{#1}\@ifnotempty{#2}{ #2}.\quad}%
   \MakeUppercase{#3}%
  }
\let\tocchapter\tocsection
\let\tocsubsection\tocsection
\def\l@section{\@tocline{1}{0pt}{0pt}{}{}}
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\bibname}{BIBLIOGRAPHY}
\renewcommand{\indexname}{INDEX}
\let\orig@caption\@caption
\def\@caption #1[#2]{\orig@caption#1[\MakeUppercase{#2}]}
\makeatother
...

enter image description here enter image description here

\documentclass[12pt]{csuthesis}
\usepackage{xpatch}
\xpatchcmd\maketitle{\scshape Abstract}{ABSTRACT}{}{}
\xpatchcmd\maketitle{\scshape Acknowledgements}{ACKNOWLEDGEMENTS}{}{}
\makeatletter
\setcounter{tocdepth}{3}
\renewcommand{\tocsection}[3]%
  {\indentlabel{\@ifnotempty{#2}{\MakeUppercase{\ignorespaces#1} #2.\quad}}%
   \MakeUppercase{#3}%
  }
\renewcommand{\tocappendix}[3]%
  {\indentlabel{\MakeUppercase{#1}\@ifnotempty{#2}{ #2}.\quad}%
   \MakeUppercase{#3}%
  }
\let\tocchapter\tocsection
\let\tocsubsection\tocsection
\def\l@section{\@tocline{1}{0pt}{0pt}{}{}}
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\bibname}{BIBLIOGRAPHY}
\renewcommand{\indexname}{INDEX}
\let\orig@caption\@caption
\def\@caption #1[#2]{\orig@caption#1[\MakeUppercase{#2}]}
\makeatother
\usepackage{lipsum}
\begin{document}
\title{The Title of This Thesis}
\author{The Author}
\departmentname{The Department Name}
\gradterm{The Grad Term}
\advisor{The Advisor}
\committee{The Committee}
\begin{abstract}
This is the abstract.
\end{abstract}
\begin{acknowledgements}
This is the abstract.
\end{acknowledgements}
\frontmatter
\maketitle
\tableofcontents
%\listoffigures
%\listoftables
\mainmatter
\chapter{First}
\lipsum[1]
\section{One}
\lipsum[1]
\begin{figure}
\rule{4cm}{3cm}
\caption{figure one}
\end{figure}
\lipsum[1]
\subsection{One one}
\lipsum[1]
\begin{table}
\rule{4cm}{3cm}
\caption{table one}
\end{table}
\lipsum[1]
\subsection{One two}
\lipsum[1]
\begin{figure}
\rule{4cm}{3cm}
\caption{figure two}
\end{figure}
\lipsum[1]
\section{Two}
\lipsum[1]
\begin{table}
\rule{4cm}{3cm}
\caption{table two}
\end{table}
\lipsum[1]
\subsection{Two one}
\lipsum[1]
\subsection{Two two}
\lipsum[1]
\chapter{Second}
\lipsum[1]
\section{One}
\lipsum[1]
\subsection{One one}
\lipsum[1]
\subsection{One two}
\lipsum[1]
\section{Two}
\lipsum[1]
\subsection{Two one}
\lipsum[1]
\subsection{Two two}
\lipsum[1]
\appendix
\chapter{Appendix}
\lipsum[1]
\end{document}