這個問題類似於問題 25346,但是建議的解決方案並不能解決我的問題。
\documentclass[parskip=full]{scrreprt}
\usepackage{amsmath, amsthm}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\begin{definition}
In luctus mattis felis ac tristique.
\end{definition}
Nunc vulputate lectus at eros vehicula.
Aliquam fermentum eu justo in lobortis.
\end{document}
產生不一致的間距:
添加
\begingroup
\makeatletter
\@for\theoremstyle:=definition,remark,plain\do{%
\expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
\addtolength\thm@preskip\parskip
}%
}
\endgroup
到序言,如建議的問題 25346產生
但這個空間現在明顯大於段落跳過。我希望 text-to-theorem-skip 的大小與 parskip 的大小相同。謝謝!
答案1
您的程式碼在\parskip
定義之前和之後基本上會產生兩個 s 。在定理之前,您可以\parskip
透過使用\setlength
而不是\addtolength
在調整中設定間距\thm@preskip
。因為在定理之後,相關數量是\thm@postskip
,但這需要設定為零,因為\parskip
無論如何都會有:
\documentclass[parskip=full]{scrreprt}
\usepackage{amsmath, amsthm}
\begingroup
\makeatletter
\@for\theoremstyle:=definition,remark,plain\do{%
\expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
\setlength\thm@preskip\parskip
\setlength\thm@postskip{0pt}
}%
}
\endgroup
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\begin{document}
\show\definition
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\begin{definition}
In luctus mattis felis ac tristique.
\end{definition}
Nunc vulputate lectus at eros vehicula.
Aliquam fermentum eu justo in lobortis.
\end{document}