我经常在 LaTeX 上使用定理,并定义了各种定理。但有时最好不要定义一个特定的定理,否则它只会用很长时间,例如“代数基本定理”或“毛球定理”等。我在网上找到的一份 pdf 建议使用以下代码:
\makeatletter
\newtheorem{@thmattr}[thm]{\theorem@attr}
\newenvironment{thmattr}[1]
{\def\theorem@attr{#1}\begin{@thmattr}}
{\end{@thmattr}}
\makeatother
唯一的问题是,除了需要计数器的定义thm
(可以通过删除 轻松解决[thm]
)之外,这还为此类定理提供了一个计数器。所以我得到了“代数 1 的基本定理”,这没有意义,因为只有一个定理同名。所以问题是:我如何创建一个没有计数器的定理?
答案1
如果你有一个命名定理,最简单的方法是
\usepackage{amsthm}
\newtheorem*{HBT}{Hairy Ball Theorem}
以便
\begin{HBT}
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{HBT}
将生产出您想要的东西。
如果您有多个命名定理,那么与您发现的类似的策略将会起作用:
\newtheorem*{namedthm*}{\thistheoremname}
\newcommand{\thistheoremname}{} % initialization
\newenvironment{namedthm}[1]
{\renewcommand{\thistheoremname}{#1}\begin{namedthm*}}
{\end{namedthm*}}
输入将是
\begin{namedthm}{Hairy Ball Theorem}
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{namedthm}
您也可以按照通常的方式给出归因:
\begin{namedthm}{Hairy Ball Theorem}[Brouwer]
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{namedthm}
完整的示例;选择您喜欢的策略。
\documentclass{article}
\usepackage{amsthm}
\newtheorem*{HBT}{Hairy Ball Theorem}
\newtheorem*{namedthm*}{\thistheoremname}
\newcommand{\thistheoremname}{} % initialization
\newenvironment{namedthm}[1]
{\renewcommand{\thistheoremname}{#1}\begin{namedthm*}}
{\end{namedthm*}}
\begin{document}
\begin{HBT}
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{HBT}
\begin{namedthm}{Hairy Ball Theorem}
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{namedthm}
\begin{namedthm}{Hairy Ball Theorem}[Brouwer]
There is no nonvanishing continuous tangent vector field on
even dimensional $n$-spheres.
\end{namedthm}
\end{document}
答案2
使用ntheorem
,您有empty
和emptybreak
定理样式。名称是可选参数。这里有 4 种可能性(我不得不修补空样式,因为它不接受label separator
):
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{MinionPro}
\usepackage{amsmath}
\usepackage[svgnames, x11names]{xcolor}
\usepackage{framed}
\usepackage[framed, amsmath, thmmarks]{ntheorem}%
\newcommand*\C{\mathbf C}
\makeatletter
\renewtheoremstyle{empty}%
{\item[]}%
{\item[\theorem@headerfont \hskip\labelsep\relax ##3\theorem@separator]}
\makeatother
\theoremheaderfont{\upshape\scshape}
\theorembodyfont{\itshape}
\theoremstyle{empty}
\theoremseparator{.\,—}
\newtheorem{namedthm}{}
\newframedtheorem{namedfrthm}{}
\theoremstyle{emptybreak}
\theoremheaderfont{\bfseries\scshape}
\theorembodyfont{\upshape\color{DarkSeaGreen4}}
\theoremseparator{\smallskip}
\newtheorem{NamedThm}{}
\newframedtheorem{NamedfrThm}{}
%\newframedtheorem{namedfrthm}}
\begin{document}
\begin{namedthm}[Fundamental Theorem of Algebra]
Every polynomial with coefficients in $ \C $ has a root in $ \C $. In other words, the field of complex numbers is algebraically closed.
\end{namedthm}
\begin{namedfrthm}[Fundamental Theorem of Algebra]
Every polynomial with coefficients in $ \C $ has a root in $ \C $. In other words, the field of complex numbers is algebraically closed.
\end{namedfrthm}
\begin{NamedThm}[Fundamental Theorem of Algebra]
Every polynomial with coefficients in $ \C $ has a root in $ \C $. In other words, the field of complex numbers is algebraically closed.
\end{NamedThm}
\begin{NamedfrThm}[Fundamental Theorem of Algebra]
Every polynomial with coefficients in $ \C $ has a root in $ \C $. In other words, the field of complex numbers is algebraically closed.
\end{NamedfrThm}
\end{document}