Теорема без счетчика (любой 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, вы получаете стили 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}

введите описание изображения здесь

Связанный контент