2

The first entry in the output from \listoftheorems in the following MWE begins with a lower-case letter, just as in the optional argument in the corresponding theorem environment.

How can that letter be made upper case — without damaging anything else, including the cleveref cross-referencing, where that letter should remain lower-case (except when at the beginning of a sentence)?

\documentclass{article}
\usepackage{suffix}
\usepackage{textcase}
\usepackage{amsthm}
\usepackage{thmtools}
\renewcommand{\listtheoremname}{List of Important Theorems}
\renewcommand\thmtformatoptarg[1]{#1}
\swapnumbers

\makeatletter
%
\declaretheoremstyle[
  headfont= \bfseries,headpunct={.},
  postheadspace=0.5em,
  notefont=\bfseries,
  headformat=\NAME\NUMBER\let\thmt@space\@empty\NOTE,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt,
  postheadhook={%
  \ifx\@empty\thmt@shortoptarg
    \renewcommand\addcontentsline[3]{}
  \fi}
]{thmstyle}

\declaretheoremstyle[
  notefont=\bfseries,
  notebraces={}{},
  headformat=\NUMBER\let\thmt@space\@empty\NOTE,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt,
  postheadhook={%
  \ifx\@empty\thmt@shortoptarg
    \renewcommand\addcontentsline[3]{}
  \fi}
]{namedthmstyle}
%
\makeatother

\theoremstyle{thmstyle}
\declaretheorem[name=Theorem,numberwithin=section]{theorem}

\declaretheorem[
  style=namedthmstyle,name=Theorem,title = {},numberlike=theorem
]{namedtheorem}

\usepackage[pdftex]{hyperref}
\hypersetup{colorlinks,linkcolor=blue}

\usepackage[nameinlink,noabbrev,capitalize]{cleveref}

\crefname{namedtheorem}{Theorem}{Theorems}
\Crefname{namedtheorem}{Theorem}{Theorems}

\newcommand{\thmref}[1]{\nameref*{#1} (\cref{#1})}
\WithSuffix\newcommand\thmref*[1]{\nameref*{#1} (\ref{#1})}

\newcommand{\namedthmref}[1]{\cref*{#1}~(\ref{#1})}
\newcommand{\Namedthmref}[1]{\Cref*{#1}~(\ref{#1})}

\makeatletter
%
\def\ll@theorem{%
  \protect\numberline{\csname the\thmt@envname\endcsname}%
  \ifx\@empty\thmt@shortoptarg
    \thmt@thmname
  \else
    \thmt@shortoptarg
  \fi}
\def\l@thmt@theorem{}
% 
 \makeatother
 
\begin{document}

\section{The theorems}

\begin{theorem}[equalities of \MakeUppercase{E}uclid]
  \label{thm:prelim}
  $a = b$ and $b = c$
\end{theorem}

\begin{namedtheorem}[name=Fundamental theorem of \NoCaseChange{Euler}]
  \label{thm:euler}
  \label[fte]{thm:euler}
  \crefformat{fte}{#2the fundamental theorem of Euler#3}
  \Crefformat{fte}{#2The fundamental theorem of Euler#3}    
  $a = c$.
\end{namedtheorem}

\begin{theorem}
  Every equilateral triangle is equiangular.
\end{theorem}

\Namedthmref{thm:euler} follows from the \nameref*{thm:prelim} follows from the 
\thmref*{thm:prelim}.

\listoftheorems

\end{document}

Lower-case initial letter in list of theorems should be upper-case

I tried to use:

\usepackage{mfirstuc}
\renewcommand\thmtformatoptarg[1]{\protect\makefirstuc{#1}}

But that does not work.

Note that the source includes:

This question is the as-yet unanswered part of my original question How remove parentheses and extra indent for named theorems in list of theorems?.

1 Answer 1

4

Use \protect\makefirstuc, but in the definition of \ll@theorem:

\documentclass{article}
\usepackage{suffix}
\usepackage{textcase}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mfirstuc}

\renewcommand{\listtheoremname}{List of Important Theorems}
\renewcommand\thmtformatoptarg[1]{#1}
\swapnumbers

\makeatletter
%
\declaretheoremstyle[
  headfont= \bfseries,headpunct={.},
  postheadspace=0.5em,
  notefont=\bfseries,
  headformat=\NAME\NUMBER\let\thmt@space\@empty\NOTE,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt,
  postheadhook={%
  \ifx\@empty\thmt@shortoptarg
    \renewcommand\addcontentsline[3]{}
  \fi}
]{thmstyle}

\declaretheoremstyle[
  notefont=\bfseries,
  notebraces={}{},
  headformat=\NUMBER\let\thmt@space\@empty\NOTE,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt,
  postheadhook={%
  \ifx\@empty\thmt@shortoptarg
    \renewcommand\addcontentsline[3]{}
  \fi}
]{namedthmstyle}
%
\makeatother

\theoremstyle{thmstyle}
\declaretheorem[name=Theorem,numberwithin=section]{theorem}

\declaretheorem[
  style=namedthmstyle,name=Theorem,title = {},numberlike=theorem
]{namedtheorem}

\usepackage[pdftex]{hyperref}
\hypersetup{colorlinks,linkcolor=blue}

\usepackage[nameinlink,noabbrev,capitalize]{cleveref}

\crefname{namedtheorem}{Theorem}{Theorems}
\Crefname{namedtheorem}{Theorem}{Theorems}

\newcommand{\thmref}[1]{\nameref*{#1} (\cref{#1})}
\WithSuffix\newcommand\thmref*[1]{\nameref*{#1} (\ref{#1})}

\newcommand{\namedthmref}[1]{\cref*{#1}~(\ref{#1})}
\newcommand{\Namedthmref}[1]{\Cref*{#1}~(\ref{#1})}

\makeatletter
%
\def\ll@theorem{%
  \protect\numberline{\csname the\thmt@envname\endcsname}%
  \ifx\@empty\thmt@shortoptarg
    \thmt@thmname
  \else
    \protect\makefirstuc{\thmt@shortoptarg}%
  \fi}
\def\l@thmt@theorem{}
% 
 \makeatother

\begin{document}

\section{The theorems}

\begin{theorem}[equalities of \MakeUppercase{E}uclid]
  \label{thm:prelim}
  $a = b$ and $b = c$
\end{theorem}

\begin{namedtheorem}[name=Fundamental theorem of \NoCaseChange{Euler}]
  \label{thm:euler}
  \label[fte]{thm:euler}
  \crefformat{fte}{#2the fundamental theorem of Euler#3}
  \Crefformat{fte}{#2The fundamental theorem of Euler#3}    
  $a = c$.
\end{namedtheorem}

\begin{theorem}
  Every equilateral triangle is equiangular.
\end{theorem}

\Namedthmref{thm:euler} follows from the \nameref*{thm:prelim} follows from the 
\thmref*{thm:prelim}.

\listoftheorems

\end{document}

enter image description here

2
  • Why does this not work if I also declare \newtheorem{proposition}[theorem]{Proposition} in preamble (after ` \theoremstyle{thmstyle}) and then in the body have something like \begin{proposition}[subsidiary result]..\end{proposition`? For that item, the list of theorems has "Propositionsubsidiaryresult" ! See tex.stackexchange.com/questions/510470/….
    – murray
    Commented Oct 1, 2019 at 17:30
  • @murray I'll have a look.
    – egreg
    Commented Oct 1, 2019 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .