我想显示一个定理标题,很简单:
\begin{theorem}[Name]
我明白了
Theorem 4.5 (Name).
但我不喜欢末尾的点。我希望它看起来像这样:
Theorem 4.5. (Name)
你能帮助我吗?
答案1
该amsthm
包允许您定义自定义定理样式,并带有自定义标题规范。要获得所需的格式,您可以定义一种新样式,例如custom
,然后theorem
使用该样式声明环境。以下是示例:
\documentclass{article}
\usepackage{amsthm}
% Create a `custom` theorem style.
\newtheoremstyle{custom}
{\topsep} % Space above
{\topsep} % Space below
{\itshape} % Body font
{0pt} % Indent amount (empty value is the same as 0pt)
{\bfseries} % Theorem head font
{} % Punctuation after theorem head
{5pt plus 1pt minus 1pt} % Space after theorem head
{\thmname{#1}\thmnumber{ #2}.\thmnote{ (#3)}} % Theorem head spec
% Create a `theorem` environment using the `custom` style.
\theoremstyle{custom}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[Name]
This is the new theorem environment.
\end{theorem}
\end{document}