使用amsthm
,是否可以按如下方式更改设置?
定理/编号/名称/引用:
身体
我尝试写:
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{mystyle}% name
{3pt}%Space above
{3pt}%Space below
{\normalfont}%Body font
{0pt}%Indent amount
{\itshape}% Theorem head font
{:}%Punctuation after theorem head
{\newline}%Space after theorem head 2
{}%Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{mystyle}
\newtheorem{teorem}{Theorem}
\begin{document}
\begin{theorem}[Ordinary differential][\cite{1}]
Test
\end{theorem}
\end{document}
答案1
一种可能性是使用xparse
包使用两个所需的可选参数来定义环境:
\documentclass{article}
\usepackage{amsthm}
\usepackage{xparse}
\newcommand\thmcite{}
\newtheoremstyle{mystyle}% name
{\topsep}%Space above
{\topsep}%Space below
{\itshape}%Body font
{0pt}%Indent amount
{\bfseries}% Theorem head font
{:}%Punctuation after theorem head
{\newline}%Space after theorem head 2
{\thmname{#1}~\thmnumber{#2}\thmnote{~(#3)}\thmcite}%Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{mystyle}
\newtheorem{theo}{Theorem}
\DeclareDocumentEnvironment{theorem}{O{}o}
{\IfNoValueTF{#2}{}{\renewcommand\thmcite{~#2}}\begin{theo}[#1]}
{\end{theo}}
\begin{document}
\begin{theorem}[Ordinary differential][\cite{1}]
Test
\end{theorem}
\begin{theorem}[Ordinary differential]
Test
\end{theorem}
\begin{theorem}[][\cite{1}]
Test
\end{theorem}
\begin{theorem}
Test
\end{theorem}
\begin{thebibliography}{9}
\bibitem{1} Author A. Title A. 2013
\end{thebibliography}
\end{document}
如果要增加头部和身体之间的距离,可以\vspace{<length>}
在第六个参数中使用适当的:
\documentclass{article}
\usepackage{amsthm}
\usepackage{xparse}
\newcommand\thmcite{}
\newtheoremstyle{mystyle}% name
{\topsep}%Space above
{\topsep}%Space below
{\itshape}%Body font
{0pt}%Indent amount
{\bfseries}% Theorem head font
{:\vspace{.5\baselineskip}}%Punctuation after theorem head
{\newline}%Space after theorem head 2
{\thmname{#1}~\thmnumber{#2}\thmnote{~(#3)}\thmcite}%Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{mystyle}
\newtheorem{theo}{Theorem}
\DeclareDocumentEnvironment{theorem}{O{}o}
{\IfNoValueTF{#2}{}{\renewcommand\thmcite{~#2}}\begin{theo}[#1]}
{\end{theo}}
\begin{document}
\begin{theorem}[Ordinary differential]%[\cite{1}]
Test
\end{theorem}
\begin{theorem}[Ordinary differential]
Test
\end{theorem}
\begin{theorem}[][\cite{1}]
Test
\end{theorem}
\begin{theorem}
Test
\end{theorem}
\begin{thebibliography}{9}
\bibitem{1} Author A. Title A. 2013
\end{thebibliography}
\end{document}
评论中提出的新要求:以类似的方式定义一些其他结构:
\documentclass{article}
\usepackage{amsthm}
\usepackage{xparse}
\newcommand\thmcite{}
\newtheoremstyle{mystyle}% name
{\topsep}%Space above
{\topsep}%Space below
{\itshape}%Body font
{0pt}%Indent amount
{\bfseries}% Theorem head font
{:\vspace{.5\baselineskip}}%Punctuation after theorem head
{\newline}%Space after theorem head 2
{\thmname{#1}~\thmnumber{#2}\thmnote{~(#3)}\thmcite}%Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{mystyle}
\newtheorem{theo}{Theorem}
\newtheorem{lemm}[theo]{Lemma}
\newtheorem{defi}[theo]{Definition}
\DeclareDocumentEnvironment{theorem}{O{}o}
{\IfNoValueTF{#2}{}{\renewcommand\thmcite{~#2}}\begin{theo}[#1]}
{\end{theo}}
\DeclareDocumentEnvironment{lemma}{O{}o}
{\IfNoValueTF{#2}{}{\renewcommand\thmcite{~#2}}\begin{lemm}[#1]}
{\end{lemm}}
\DeclareDocumentEnvironment{definition}{O{}o}
{\IfNoValueTF{#2}{}{\renewcommand\thmcite{~#2}}\begin{defi}[#1]}
{\end{defi}}
\begin{document}
\begin{theorem}[Ordinary differential]
Test theorem.
\end{theorem}
\begin{definition}
Test definition.
\end{definition}
\begin{lemma}[][\cite{1}]
Test lemma.
\end{lemma}
\begin{thebibliography}{9}
\bibitem{1} Author A. Title A. 2013
\end{thebibliography}
\end{document}
思路是一样的,先用\newtheorem
一个创建基本的定理结构,然后借助xparse
相应的环境和两个必需的可选参数进行定义。
所有三个结构共享一个计数器;可以使用可选参数轻松更改它(以及使计数器从属于已经存在的计数器)\newtheorem
(amsthm
有关详细信息,请参阅包文档)。
答案2
您可以使用该包amsthm
来定义具有中断样式的定理环境。
\usepackage{amsthm}
\newtheoremstyle{break} % style name
{} % space above, empty = `usual value'
{} % space below
{} % body font
{} % indent
{\bfseries} % head font
{.} % punctuation after head
{\newline} % space after head
{} % Thm head spec
\theoremstyle{break}
\newtheorem{theorem}{Theorem}
或者使用包ntheorem
。这里的样式break
已经定义好了。
\usepackage{ntheorem}
\theoremstyle{break}
\newtheorem{theorem}{Theorem}