Kiểu định lý lạ mắt

Sep 04 2020

Tôi muốn viết một số định lý với đầu ra hơi tự định nghĩa như "Định lý A, Định lý B, Định lý B ^ +, Định lý B ^ #", v.v. và muốn các định lý đặc biệt nằm ngoài bộ đếm định lý thông thường, tức là định lý khác các định lý giữ số riêng của chúng như "Định lý 1.1, Định lý 1.2" thậm chí thông qua "Định lý B" nằm giữa chúng. Có cách nào dễ dàng để đạt được điều này không?

Điều này có thể liên quan đến câu hỏi ở đây nhưng tôi nghĩ rằng đó không phải là câu hỏi của tôi ở đây. Cảm ơn trước!

Trả lời

6 egreg Sep 03 2020 at 23:27

Một cái gì đó như thế này?

\documentclass{article}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{theoremvar}{Theorem}
\newenvironment{theorem*}[1]
 {\renewcommand{\thetheoremvar}{#1}\theoremvar}
 {\endtheoremvar}

\begin{document}

\section{Title}

\ref{normal1},
\ref{normal2},
\ref{normal3},
\ref{normal4},
\ref{special1},
\ref{special2},
\ref{special3}

\begin{theorem}\label{normal1}
This is a normal theorem.
\end{theorem}

\begin{theorem}\label{normal2}
This is a normal theorem.
\end{theorem}

\begin{theorem*}{A}\label{special1}
This is a special theorem.
\end{theorem*}

\begin{theorem}\label{normal3}
This is a normal theorem.
\end{theorem}

\begin{theorem*}{B$^+$}\label{special2}
This is a special theorem.
\end{theorem*}

\begin{theorem*}{B$^{\sharp}$}\label{special3}
This is a special theorem.
\end{theorem*}

\begin{theorem}\label{normal4}
This is a normal theorem.
\end{theorem}

\end{document}

Các theorem*môi trường có một cuộc tranh luận bắt buộc đối với các nhãn đặc biệt.