[Tex/LaTex] Capitalize list of tables in Table of Contents

capitalizationtable of contents

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.

enter image description here

Best Answer

Use the optional arguments to \caption and/or \section. EDITED to follow egreg's emphatic recommendation.

\documentclass[11pt]{article}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\listoftables
\noindent\hrulefill

\section[\MakeUppercase{this is the first of two sections}]{this is the first of two sections}

\lipsum[4]

\section[\MakeUppercase{blah for blah}]{blah for blah}

\lipsum[3]

\begin{table}[ht]
\centering
\caption[\MakeUppercase{this is the table for this section}]{this is the table for this section}
\begin{tabular}{|c|c|}
\hline
This is & my table\\
\hline
\end{tabular}
\end{table}
\end{document}

enter image description here

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:

\documentclass[11pt]{article}
\usepackage{lipsum}
\let\svcaption\caption
\let\svtable\table
\def\table{\tablecaps\svtable}
\def\tablecaps{%
  \renewcommand\caption[2][]{\svcaption[\MakeUppercase{##2}]{##2}}
}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\noindent\hrulefill
\section{blah for blah}

\begin{figure}[ht]
\centering
\framebox{My Figure}
\caption{this is the figure caption}
\end{figure}
\begin{table}[ht]
\centering
\caption{this is the table for this section}
\begin{tabular}{|c|c|}
\hline
This is & my table\\
\hline
\end{tabular}
\end{table}
\end{document}

enter image description here