以定理样式向标题格式添加新参数

以定理样式向标题格式添加新参数

我正在使用 amsthm 包来获得定理环境。我想显示类似Axiom 1 = BA 1 (Some text)BA 是另一篇论文的公理的引用的内容。

所以我尝试了这个:

  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}% measure of space to indent
  {\bfseries}% name of head font
  {.}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}\thmnumber{ #2} = BA \thmnumber{#4}\thmnote{ (#3)}}

但我得到了错误Illegal parameter number in definition of \thmhead@theoremdd.

有可能实现我想要的东西吗?如果可以,怎么做?谢谢。

答案1

您不能添加这样的参数。

我建议如下:

\documentclass{article}
\usepackage{amsmath,amsthm}

\newtheoremstyle{axiom}
  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}% measure of space to indent
  {\bfseries}% name of head font
  {.}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}\thmnumber{ #2\extraref}\thmnote{ (#3)}}

\theoremstyle{axiom}
\newtheorem{axiominner}{Axiom}
\newcommand{\extraref}{}
\newenvironment{axiom}[1]
 {%
  \if\relax\detokenize{#1}\relax
  \else
    \renewcommand{\extraref}{ = BA #1}% if argument is empty, add nothing
  \fi
  \begin{axiominner}}
 {\end{axiominner}}

\begin{document}

\begin{axiom}{1}[Some text]
This is an axiom.
\end{axiom}

\begin{axiom}{1}
This is an axiom.
\end{axiom}

\begin{axiom}{}[Some text]
This is an axiom.
\end{axiom}

\begin{axiom}{}
This is an axiom.
\end{axiom}

\end{document}

如果需要外部引用,请在强制的参数axiom。这将(本地)重新定义宏\extraref以打印所需的输出。

在此处输入图片描述

相关内容