以下 MWE输出中的第一个条目\listoftheorems
以小写字母开头,就像相应定理环境中的可选参数一样。
如何才能将该字母变为大写,而不会损坏其他任何内容,包括cleveref
交叉引用,而该字母应该保持小写(除了在句子开头时)?
\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}
我尝试使用:
\usepackage{mfirstuc}
\renewcommand\thmtformatoptarg[1]{\protect\makefirstuc{#1}}
但确实如此不是工作。
请注意,来源包括:
cleveref
相关代码,只是为了确保我的问题的解决方案不会破坏名称的交叉引用;- 代码如下https://tex.stackexchange.com/a/401600/13492,以及
cleveref
在其他地方,与命令中命名定理的大写有关; - 代码如下https://tex.stackexchange.com/a/16498/13492使用
theorem
环境的可选参数作为定理列表中的条目;以及 \renewcommand\thmtformatoptarg[1]{#1}
, 建议来自https://tex.stackexchange.com/a/193020/13492,用于删除namedtheorem
定理列表中条目中不需要的括号。
这个问题是我最初问题中尚未回答的部分如何删除定理列表中命名定理的括号和额外缩进?。
答案1
使用\protect\makefirstuc
,但在 的定义中\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}