在 LaTeX 中,如何为某些特殊定理标注星号?
喜欢
定理1.1.这是一个正规定理。
定理1.2*.这是一个特殊定理。
答案1
这是一个使用amsthm
包并创建定理样式副本的解决方案plain
,称为special
,它共享样式的所有属性,plain
除了在\asterisk
定理编号后插入一个凸起的粗体。代码可以处理具有可选参数/名称的特殊定理的情况;参见下面的第三个示例。
\documentclass{article}
\usepackage{amsthm,bm}
\newtheoremstyle{special}% name
{\topsep}% Space above
{\topsep}% Space below
{\itshape}% Body font
{}% Indent amount
{\bfseries}% Theorem head font
{}% Punctuation after theorem head -- blank
{0.5em}% Space after theorem head (0.5em is the default)
{{\thmname{#1}\thmnumber{ #2$^{\bm*}\!$.}\thmnote{\ \textmd{(#3)}}}}% Theorem head spec
% Set up two theorem-like environments:
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\theoremstyle{special}
\newtheorem{spthm}[thm]{Theorem}
\begin{document}
\stepcounter{section}
\begin{thm} This is a normal theorem. \end{thm}
\begin{spthm} This is a special theorem. \end{spthm}
\begin{spthm}[Euler] $\exp(i\pi)+1=0$. \end{spthm}
\end{document}
答案2
像这样吗?
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheoremstyle{special}
{\topsep}
{\topsep}
{\itshape}
{}
{\bfseries}
{\,\(\star\).}
{.5em}
{}
\newtheorem{thm}{Theorem}
\theoremstyle{special}
\newtheorem{thm*}[thm]{Theorem}
\begin{document}
\begin{thm}
This is a normal theorem.
\end{thm}
\begin{thm*}
This is a special theorem.
\end{thm*}
\end{document}
答案3
这取决于你想如何排版参考文献。如果你还想在定理交叉引用时使用星号,下面的方法就足够了。它也适用于cleveref
。
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\newenvironment{theorem*}
{\expandafter\def\expandafter\thetheorem\expandafter{\thetheorem*}\theorem}
{\endtheorem}
\begin{document}
\section{Test}
\begin{theorem}\label{normal}
This is a normal theorem
\end{theorem}
\begin{theorem*}\label{special}
This is a special theorem
\end{theorem*}
\ref{normal} and \ref{special}
\end{document}
如果您希望交叉引用不带星号,您可以执行以下操作:
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\let\standardthetheorem\thetheorem
\def\starredthetheorem{\standardthetheorem*}
\newenvironment{theorem*}
{\labelformat{theorem}{\standardthetheorem}%
\let\thetheorem\starredthetheorem
\theorem}
{\endtheorem}
\begin{document}
\section{Test}
\begin{theorem}\label{normal}
This is a normal theorem
\end{theorem}
\begin{theorem*}\label{special}
This is a special theorem
\end{theorem*}
\ref{normal} and \ref{special}
\begin{theorem}
This is another normal theorem
\end{theorem}
\end{document}
但这不适用于cleveref
。