我正在使用amsart
交换定理数字的文档类(通过使用\swapnumbers
),并且我想在数字前面用星号标记我的一些定理、引理、示例等,如 *4.5。定理以表明读者无需知道它们。有没有简单的方法可以做到这一点?
答案1
如果星号也出现在交叉引用中,那就简单了。
\documentclass{amsart}
\usepackage{etoolbox}
\swapnumbers
\newtheorem{theorem}{Theorem}
\numberwithin{theorem}{section}
\newenvironment{theorem*}
{\preto{\thetheorem}{*}\theorem}
{\endtheorem}
\begin{document}
\section{Title}
\begin{theorem}\label{easy}
This is an easy theorem.
\end{theorem}
\begin{theorem*}\label{hard}
The zeros of the zeta function have real part equal to $1/2$.
\end{theorem*}
Theorem~\ref{easy} is an easy consequence of theorem~\ref{hard}
a proof of which is too long for this short note.
\end{document}
交叉引用中没有星号的非破解版本允许在边缘处使用星号。
\documentclass{amsart}
\newtheoremstyle{swapped}% <name>
{\topsep}% <space above>
{\topsep}% <space below>
{\itshape}% <body font>
{}% <indent amount>
{\bfseries}% <theorem head font>
{.}% <punctuation after theorem head>
{.5em}% <space after theorem head>
{\thmnumber{\textnormal{#2} }\thmname{#1}\thmnote{ (#3)}}% <theorem head spec>
\newtheoremstyle{starred}% <name>
{\topsep}% <space above>
{\topsep}% <space below>
{\itshape}% <body font>
{}% <indent amount>
{\bfseries}% <theorem head font>
{.}% <punctuation after theorem head>
{.5em}% <space after theorem head>
{\thmnumber{\textnormal{\makebox[0pt][r]{*}#2} }\thmname{#1}\thmnote{ (#3)}}% <theorem head spec>
\theoremstyle{swapped}
\newtheorem{theorem}{Theorem}
\numberwithin{theorem}{section}
\theoremstyle{starred}
\newtheorem{theorem*}[theorem]{Theorem}
\begin{document}
\section{Title}
\begin{theorem}\label{easy}
This is an easy theorem.
\end{theorem}
\begin{theorem*}\label{hard}
The zeros of the zeta function have real part equal to $1/2$.
\end{theorem*}
Theorem~\ref{easy} is an easy consequence of theorem~\ref{hard}
a proof of which is too long for this short note.
\end{document}
相同的破解版本,可以避免\newtheoremstyle
:
\documentclass{amsart}
\usepackage{etoolbox}
\swapnumbers
\newtheorem{theorem}{Theorem}
\numberwithin{theorem}{section}
\makeatletter
\newenvironment{theorem*}
{\patchcmd\@thm{\csname}{\makebox[0pt][r]{*}\csname}{}{}\theorem}
{\endtheorem}
\makeatother
\begin{document}
\section{Title}
\begin{theorem}\label{easy}
This is an easy theorem.
\end{theorem}
\begin{theorem*}\label{hard}
The zeros of the zeta function have real part equal to $1/2$.
\end{theorem*}
Theorem~\ref{easy} is an easy consequence of theorem~\ref{hard}
a proof of which is too long for this short note.
\end{document}