通过在定理编号后添加 * 来排版定理的细微变化

通过在定理编号后添加 * 来排版定理的细微变化

假设我有一个有关数字和一切的定理,如下所述:

定理 1.2.3:Blah Blah Blah……

有时你想对同一个定理做一些细微的变化,或者用不同的语言来写它等等。数学家会使用这样的符号:

定理 1.2.3*: 不同的 Blah Blah Blah

因此最后的文本如下所示:

定理 1.2.3:Blah Blah Blah……

定理 1.2.3*: 不同的 Blah Blah Blah

如何在 LaTeX 中执行 * 操作?

编辑我的无星号版本的代码如下:

\documentclass[11pt]{article}
\usepackage{amsmath} 
\usepackage{amsthm}
\newtheorem{thm}{Theorem}[subsection]
\begin{document}
\section{Blah}
\subsection{Blah Blah}


Typesetted as Theorem 1.1.1:
\begin{thm}[Theorem 1]
Blah Blah Blah
\end{thm}


Typesetted as Theorem 1.1.2
\begin{thm}[Theorem 2]
Blah Blah Blah
\end{thm}


The first theorem with slight variation:
I want this to be typesetted as Theorem 1.1.1*: Blah Blah Blah
%% The code for this??? %%
\end{document}

答案1

您可以声明一个新定理,只需添加一个 ,使其计数器看起来像常规计数器即可*。如果您想引用文档中其他地方的定理,请使用\label-\ref系统并通过 提供新数字\thmstarnum{\ref{<label>}}

在此处输入图片描述

\documentclass{article}
\usepackage{amsthm}
\newtheorem{thm}{Theorem}[subsection]
\newtheorem{thm*}{Theorem}% This is a fake theorem environment
% update the counter to look the same as that of 'thm' + '*'

\makeatletter
\expandafter\newcommand\csname thethm*default\endcsname{\thethm*}
\newcommand{\thmstarnum}[1]{\expandafter\gdef\csname thethm*\endcsname{#1*}}
\thmstarnum{\thethm}
\expandafter\g@addto@macro\csname endthm*\endcsname{\thmstarnum{\thethm}}
\makeatother

\begin{document}

\section{This is a section}
\subsection{This is a subsection}
Here is some text.
\begin{thm}\label{thm:first}
This is the first theorem.
\end{thm}
Here is some more text, and then another theorem.
\begin{thm}[Something]
This is the second theorem.
\end{thm}
Now we look at the same theorem again.
\begin{thm*}[Something else]
This is the second theorem again.
\end{thm*}
Now let's review the first theorem again.
\thmstarnum{\ref{thm:first}}
\begin{thm*}
This is the first theorem again.
\end{thm*}
Now the rest of the document with some more theorems.
\begin{thm}
This is the third theorem.
\end{thm}
Let's revisit the third theorem.
\begin{thm*}
This is the third theorem again.
\end{thm*}
The conclusion.

\end{document}

答案2

如果你想允许“变体定理”出现在任何地方(甚至标准的一个),你需要使用\labeland \ref

\documentclass[11pt]{article}
\usepackage{amsmath} 
\usepackage{amsthm}

\newtheorem{thm}{Theorem}[subsection]
\newtheorem*{varthm+inner}{\varthmname}
\newcommand{\varthmname}{}
\newenvironment{varthm}[2][Theorem]
 {\renewcommand{\varthmname}{#1 \ref{#2}*}\begin{varthm+inner}}
 {\end{varthm+inner}}

\begin{document}

\section{Blah}
\subsection{Blah Blah}

Typeset as Theorem 1.1.1:
\begin{thm}\label{test}
Blah Blah Blah
\end{thm}


Typeset as Theorem 1.1.2
\begin{thm}
Blah Blah Blah
\end{thm}

Typeset as Theorem 1.1.1*
\begin{varthm}{test}
Blah blah
\end{varthm}

\end{document}

在此处输入图片描述

我添加了一个可选参数,这样你还可以通过调用来排版变体词元或者其他东西

\begin{varthm}[Lemma]{label}

归因论证得到尊重,通过调用

\begin{varthm}{label}[Somebody]

示例代码

Typeset as Theorem 1.1.1:
\begin{thm}[A. Uthor]\label{test}
Blah Blah Blah
\end{thm}

Typeset as Theorem 1.1.2
\begin{thm}
Blah Blah Blah
\end{thm}

Typeset as Theorem 1.1.1*
\begin{varthm}{test}[W. Riter]
Blah blah
\end{varthm}

相关内容