我发现\newtheoremstyle
的amsthm
非常方便。据我所知,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}