沒有計數器的定理(任何 TeX)

沒有計數器的定理(任何 TeX)

我經常在 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,您可以得到emptyemptybreak定理樣式。此名稱是一個可選參數。這裡有 4 種可能性(我必須修補空樣式,因為它不接受 a 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}

在此輸入影像描述

相關內容