我正在写一篇数学文章book
,想用ntheorem
定理。另外,我想使用parskip
,因为我更喜欢这些段落样式。我的问题是,一旦我包含包parskip
,定理前后的间距也会改变。如何避免这种情况?我尝试使用命令\theorempreskip
和\theorempostskip
修改我的 ntheorem。但尽管这些命令列在官方 CTAN 文档,我总是收到类似的错误undefined control sequence \theorempreskip
。
以下是 MWE:
\documentclass{book}
\usepackage{amsmath} %mathematical expressions
\usepackage{amscd} %commutative diagrams
\usepackage{amssymb} %ams math symbols
\usepackage[T1]{fontenc} %german umlauts
\usepackage[utf8]{inputenc} %UTF-8 compatibility
\usepackage{parskip} %no indentation at beginning of paragraph
\usepackage[thmmarks,amsmath]{ntheorem}
%Theoremstyles
\makeatletter
\newtheoremstyle{mythmstyle}%
{\item[\theorem@headerfont\hskip\labelsep ##1\ ##2\theorem@separator]}%
{\item[\theorem@headerfont\hskip\labelsep ##1\ ##2\ \normalfont{(##3)}\textbf{\theorem@separator}]}
\makeatother
%Theorems with mystle
\theoremstyle{mythmstyle}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\theoremsymbol{$\blacklozenge$}
%\theorempreskip{\baselineskip}
%\theorempostskip{\baselineskip}
\newtheorem{Def}{Definition}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\begin{Def}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\end{Def}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\end{document}
%Theoremstyles
\makeatletter
\newtheoremstyle{mythmstyle}%
{\item[\theorem@headerfont\hskip\labelsep ##1\ ##2\theorem@separator]}%
{\item[\theorem@headerfont\hskip\labelsep ##1\ ##2\ \normalfont{(##3)}\textbf{\theorem@separator}]}
\makeatother
%Theorems with mystle
\theoremstyle{mythmstyle}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\theoremsymbol{$\blacklozenge$}
%\theorempreskip{\baselineskip}
%\theorempostskip{\baselineskip}
\newtheorem{Def}{Definition}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\begin{Def}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\end{Def}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend blandit dolor, vel ultricies erat suscipit sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis accumsan magna et purus facilisis posuere.
\end{document}
答案1
即使我取消注释\theorempreskip
和,您的示例对我来说也运行良好\theorempostskip
。文档的第 2.3.5 节ntheorem
表明这些命令是在版本 1.32 中引入的;旧版本对间距的处理不同,并使用命令\theorempreskipamount
和\theorempostskipamount
。您的问题很可能是由过时的ntheorem
版本引起的;尝试更新您的 TeX 发行版或查看旧宏(其名称中包含“amount”)是否产生可接受的间距。