如何从定理可选参数中删除括号?

如何从定理可选参数中删除括号?

这是一个 MWE:

\documentclass[12pt]{article}

\usepackage{amsfonts, amsthm, amsmath, amssymb}

\theoremstyle{definition}
\newtheorem{Theorem}{Theorem}[section]

\newtheorem*{Pythagorean theorem}{Pythagorean theorem}

%=======

\begin{document}

\begin{Pythagorean theorem}[\cite{Pythagoras}]
This is Pythagoras' theorem.
\end{Pythagorean theorem}

%===

\begin{thebibliography}{HD}

\bibitem[1]{Pythagoras}
Pythagoras' theorem.

\end{thebibliography}

\end{document}

如果我使用

\newtheorem*{Pythagorean theorem}{Pythagorean theorem}

\begin{Pythagorean theorem}[\cite{Pythagoras}]
This is Pythagoras' theorem.
\end{Pythagorean theorem}

我得到以下信息:

勾股定理([1])这就是毕达哥拉斯定理。

我的问题是:如何删除 [1] 周围的括号?

换句话说,我希望 LaTeX 显示以下内容:

勾股定理[1]这就是毕达哥拉斯定理。

请注意,上面句子中的第一个句号必须用粗体表示。

答案1

您需要更新定理标头的设置方式,因为它( )默认包含(取自amsclass.dtx):

\def\thmhead@plain#1#2#3{%
  \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
  \thmnote{ {\the\thm@notefont(#3)}}}
\let\thmhead\thmhead@plain

注意上面的用法(#3)。因此,我们复制粘贴上面的定义并进行调整:

\makeatletter
\def\thmhead@plain#1#2#3{%
  \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
  \thmnote{ {\the\thm@notefont#3}}}
\let\thmhead\thmhead@plain
\makeatother

这只是删除了( )。这是 MWE:

在此处输入图片描述

\documentclass{article}

\usepackage{amsthm}% http://ctan.org/pkg/amsthm

\makeatletter
\def\thmhead@plain#1#2#3{%
  \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
  \thmnote{ {\the\thm@notefont#3}}}
\let\thmhead\thmhead@plain
\makeatother
\theoremstyle{definition}

\newtheorem{Theorem}{Theorem}[section]

\newtheorem*{Pythagorean theorem}{Pythagorean theorem}

\expandafter\show\csname Pythagorean theorem\endcsname
%=======

\begin{document}

\begin{Pythagorean theorem}[\cite{Pythagoras}]
This is Pythagoras' theorem.
\end{Pythagorean theorem}

%===

\begin{thebibliography}{HD}

\bibitem[1]{Pythagoras}
Pythagoras' theorem.

\end{thebibliography}

\end{document}

一个稍微简单的解决方案是通过etoolbox修补:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\thmhead}{(#3)}{#3}{}{}

相关内容