如何将定理标题放在方括号中(而不是括号中)

如何将定理标题放在方括号中(而不是括号中)

返回结果如下MWE

Theorem 1 (title). theorem's body

\documentclass{article}

\usepackage{amsthm}

\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}[title]
    theorem's body
\end{thm}

\end{document}

我怎样才能得到类似下面的内容?

Theorem 1 [title]. theorem's body

答案1

您可以从 复制粘贴amsthm.sty

\documentclass{article}

\usepackage{amsthm}

\makeatletter
\def\thmheadbrackets#1#2#3{%
  \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
  \thmnote{ {\the\thm@notefont[#3]}}}
\makeatother

\newtheoremstyle{brakets}% Name
  {}% space above
  {}% space below
  {\itshape}% body font
  {}% indent
  {\bfseries}% head font
  {.}% punctuation after head
  { }% space after head (has to be space or dimension!)
  {\thmheadbrackets{#1}{#2}{#3}}% head spec

\theoremstyle{brakets}
\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}[title]
    theorem's body
\end{thm}

\end{document}

在此处输入图片描述

相关内容