How to write the chapter titles in Upper Case in the table of contents ?
[Tex/LaTex] Upper case chapter titles in the table of contents
table of contents
Related Solutions
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
...
\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}
I managed to fix it using a general solution for the article
class I find on How to make section name uppercase in ToC?:
\documentclass{memoir}
\usepackage{textcase}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\makeatletter
\let\oldcontentsline\contentsline
\def\contentsline#1#2{%
\expandafter\ifx\csname l@#1\endcsname\l@section
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{%
\oldcontentsline{#1}{\MakeTextUppercase{#2}}%
}{%
\oldcontentsline{#1}{#2}%
}%
}
\makeatother
\begin{document}
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\chapter{Chapter One}
\section{Section One One}
\subsection{Section One One}
\section{Section One Two}
\subsection{Section One Two}
\section{Section One Three}
\section{Section One Four}
\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}
\end{document}
Also it was required to remove these statements from my file:
\renewcommand*{\l@chapter}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftchaptername}
}
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\ABNTEXsectionfont\uppercase{#1}}{#2}{\cftsectionname}
}
They were the cause of all my problems. I am not sure why they are scrolling everything, as causing the spacing between the section and chapter to be the same as the space between chapters.
This last should be due the fact that the command is redefining the \l@section
with \l@chapapp
, which is just like begging for trouble and weird behaviors.
Here are some related references for the memoir class and table of contents:
- Uppercase sections and subsections on ToC
- Uppercasing in a "memoir" Table of Contents with "hyperref"
- Making memoir Chapter entries in ToC all-caps and Appendix entries regular case, without breaking hyperref
- hyperref, MakeUppercase and memoir
- TOC Spacing in Memoir
- Bind vertical spacing change in ToC to \*matter commands
- How to change this specific TOC margin in memoir
- Change vertical space of chapters temporarly in Table of Contents
Best Answer
The only change is
\MakeUppercase
.