How can I capitalize all the table names in the Table of Contents, List of Tables?
I am not talking about the headings, but the actual entries. E.g., the first entry in the picture is ok, as it is uppercase, while the others are not.
[Tex/LaTex] Capitalize list of tables in Table of Contents
capitalizationtable of contents
Related Solutions
Here's one possibility, using the titlesec
package. The idea is to define two commands allowing you to switch the section title formatting as many times as required; \CentSections
gives you centered uppercased headings and \StdSections
gives you the standard flushed, sentence-case headings.
\documentclass[english]{article}
\usepackage{babel}
\usepackage{titlesec}
\usepackage{titletoc}
\titleformat*{\section}{\bfseries\normalsize}
\titleformat*{\subsection}{\bfseries\normalsize}
\titleformat*{\subsubsection}{\bfseries\normalsize}
\titlecontents{section} % set formatting for \section - \subsection must be formatted separately
[2.3em] % adjust left margin
{\rmfamily} % font formatting
{\contentslabel{2.3em}} % section label and offset
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
\newcommand\CentSections{
\titleformat{\section}
{\normalfont\bfseries\normalsize\centering}{\thesection}{1em}{\MakeUppercase}
}
\newcommand\StdSections{
\titleformat{\section}
{\normalfont\bfseries\normalsize}{\thesection}{1em}{}
}
\begin{document}
\CentSections
\tableofcontents
\listoffigures
\listoftables
\StdSections
\section{This is a standard section}
\subsection{This is a subsection}
\section{This is the second standard section}
\subsection{This is another subsection}
\CentSections
\addcontentsline{toc}{section}{\protect\underline{\refname}}
\bibliographystyle{plain}
\bibliography{biblio}
\StdSections
\appendix
\section{An appendix}
\end{document}
An image of the resulting document:
\documentclass[10pt,oneside]{book}
\usepackage[margin=1in]{geometry}
\usepackage{tocloft} % this package styles ToC, LoT and LoF
%========= Customizing ToC
% Z represents all three ToC, LoT an LoF respectively
% adding 1in vertical space to make total 2 inch space from top for Z
\setlength{\cftbeforetoctitleskip}{1in}
\setlength{\cftbeforelottitleskip}{1in}
\setlength{\cftbeforeloftitleskip}{1in}
\setlength{\cftaftertoctitleskip}{0pt}
% making titles of Z respectively centered and fontsize is
% \Large which can be changed to any value desired
\renewcommand{\cfttoctitlefont}{{~}\hfill\Huge}
\renewcommand{\cftaftertoctitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
\renewcommand{\cftlottitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterlottitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
\renewcommand{\cftloftitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterloftitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
% reducing dot separation to make it look like a dotted line
\renewcommand{\cftdotsep}{1}
% increasing width for page number for Z
\cftsetpnumwidth{1cm}
% increasing right margin which makes width available for titles smaller
% hence grater the value smaller the title width
\cftsetrmarg{3cm}
% these commands sets leaders for part and chapter which by default
% are not shown, to make them disappear again replace dotsep value by
% \cftnodot
% e.g. \renewcommand{\cftpartdotsep}{\cftnodot}
\renewcommand{\cftpartdotsep}{1}
\renewcommand{\cftpartleader}{\cftdotfill{\cftpartdotsep}}
\renewcommand{\cftchapdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures
\part{Part One}
\chapter{Chapter One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\chapter{Chapter Two}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\chapter{Chapter Three}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\part{Appendix}
% Use starred version of chapters, section etc which do not appear in table of contents
\chapter*{A}
\chapter*{B}
\part{Index}
\end{document}
Best Answer
Use the optional arguments to
\caption
and/or\section
. EDITED to follow egreg's emphatic recommendation.Based on a follow-up query by the OP, here is a way to get just the LOT (but not the LOF) to automatically capitalize the table captions: