有没有可以替代 amsthm 的 \newtheoremstyle 的 LNCS?

有没有可以替代 amsthm 的 \newtheoremstyle 的 LNCS?

我发现\newtheoremstyleamsthm非常方便。据我所知,LNCS 类只有\spnewtheorem允许更改头部字体和正文字体。相比之下,\newtheoremstyle允许更改更多内容(例如:定理头部后的标点符号、定理环境前后的空间量)。
\newtheoremstyle是否存在可以提供类似于的更多控制的 LNCS 类命令amsthm

这是一个 mwe。

  \documentclass{llncs}
  \spnewtheorem{mytheorem}{Theorem}{\bfseries}{}

  %\documentclass{article}
  %\usepackage{amsthm}
  %\newtheorem{theorem}{Theorem}
  %\newtheoremstyle{freethm}% <name>
  %{3pt}% <Space above>
  %{3pt}% <Space below>
  %{}% <Body font>
  %{}% <Indent amount>
  %{\bfseries}% <Theorem head font>
  %{}% <Punctuation after theorem head>
  %{.5em}% <Space after theorem headi>
  %%{\bfseries}% <Theorem head spec (can be left empty, meaning `normal')>
  %{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}.\\}
  %\theoremstyle{freethm}
  %\newtheorem{mytheorem2}{Theorem}

  \begin{document}
  \begin{theorem}[LNCS/asmthm style]
  A nice theorem.
  \end{theorem}
  \begin{mytheorem}[LNCS spnewtheorem]
  Another nice theorem.
  \end{mytheorem}
  %\begin{mytheorem2}[amsthm newtheoremstyle]
  %Another nice theorem.
  %\end{mytheorem2}
  \end{document}

输出结果如下:
在此处输入图片描述

当我取消注释该行时\usepackage{amsthm},我收到错误“命令 \proof 已定义。”。我认为这是因为llncs.sty包含并重新定义了 amsthm 的许多定理环境(以及证明环境)。无论如何,似乎可以忽略此错误。但是,当\newtheoremstyle取消注释该命令时,我收到无法忽略的错误。

答案1

您可以使用amsthm,只要您删除proof由文档类定义的环境即可。

\documentclass[runningheads]{llncs}
\usepackage[T1]{fontenc}

\let\proof\relax\let\endproof\relax
\usepackage{amsthm}

\newtheoremstyle{freethm}% <name>
 {3pt}% <Space above>
 {3pt}% <Space below>
 {\itshape}% <Body font>
 {}% <Indent amount>
 {\bfseries}% <Theorem head font>
 {}% <Punctuation after theorem head>
 {\newline}% <Space after theorem headi>
 {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}.} % Head spec

\theoremstyle{freethm}
\newtheorem{mytheorem}{Theorem}



\begin{document}

\title{Contribution Title\thanks{Supported by organization x.}}

\author{First Author}

\authorrunning{F. Author}

\institute{Some University, Someplace\\\email{[email protected]}}

\maketitle

\begin{abstract}
The abstract should briefly summarize the contents of the paper in
150--250 words.

\keywords{First keyword  \and Second keyword \and Another keyword.}
\end{abstract}

\section{First Section}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\begin{theorem}[Standard]
This is a theorem in the standard style.
\end{theorem}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\begin{mytheorem}[Free]
This is a theorem in the free style.
\end{mytheorem}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\end{document}

在此处输入图片描述

如果要保留proof类定义的环境,可以执行以下操作:

\documentclass[runningheads]{llncs}
\usepackage[T1]{fontenc}

% save the proof environment defined by the class
\let\lncsproof\proof \let\lncsendproof\endproof \let\lncsqed\qed
% remove the definitions in order to load amsthm
\let\proof\relax\let\endproof\relax

\usepackage{amsthm}

% restore the class defined proof
\let\proof\lncsproof \let\endproof\lncsendproof \let\qed\lncsqed

\newtheoremstyle{freethm}% <name>
 {3pt}% <Space above>
 {3pt}% <Space below>
 {\itshape}% <Body font>
 {}% <Indent amount>
 {\bfseries}% <Theorem head font>
 {}% <Punctuation after theorem head>
 {\newline}% <Space after theorem headi>
 {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}.}

\theoremstyle{freethm}
\newtheorem{mytheorem}{Theorem}



\begin{document}

\title{Contribution Title\thanks{Supported by organization x.}}

\author{First Author}

\authorrunning{F. Author}

\institute{Some University, Someplace\\\email{[email protected]}}

\maketitle

\begin{abstract}
The abstract should briefly summarize the contents of the paper in
150--250 words.

\keywords{First keyword  \and Second keyword \and Another keyword.}
\end{abstract}

\section{First Section}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\begin{theorem}[Standard]
This is a theorem in the standard style.
\end{theorem}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\begin{mytheorem}[Free]
This is a theorem in the free style.
\end{mytheorem}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\begin{proof}
This is a proof in the standard style.\qed
\end{proof}

Please note that the first paragraph of a section or subsection is
not indented. The first paragraph that follows a table, figure,
equation etc. does not need an indent, either.

\end{document}

在此处输入图片描述

另一方面,如果你不在\qed证明的末尾恢复并删除,你会得到

在此处输入图片描述

这看起来与另一张图片非常相似(并且更容易维护,因为您不需要手动添加\qed)。

答案2

\newtheoremstyle即使与 class 一起使用,您的声明也会出现错误article。似乎有一个虚假的最后一行 using#是从\newcommand或类似构造中复制而来的。

如果我修复了这个问题,那么代码就可以与我在以下位置找到的 llncs 副本一起工作,而不会发生任何变化

https://www.win.tue.nl/~setalle/tex/llncs.cls

如果您未定义证明环境,则让我们amsthm定义它。

%\documentclass{article}
\documentclass{llncs}

\let\proof\undefined
\let\endproof\undefined
\usepackage{amsthm}

 % \spnewtheorem{mytheorem}{Theorem}{\bfseries}{}

\newtheoremstyle{mytheorem}% <name>
{3pt}% <Space above>
{3pt}% <Space below>
{}% <Body font>
{}% <Indent amount>
{\bfseries}% <Theorem head font>
{}% <Punctuation after theorem head>
{.5em}% <Space after theorem headi>
{\bfseries}% <Theorem head spec (can be left empty, meaning `normal')>


%??????{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}.\\}

\newtheorem{ztheorem}{theorem}

  \begin{document}
 
  \begin{ztheorem}[LNCS spnewtheorem]
  Another nice theorem.
  \end{ztheorem}
  \end{document}

相关内容