定理环境内的段落间距

定理环境内的段落间距

我正在尝试为以下问题找到一个简单的解决方案。我希望我的定义、命题和证明中的段落之间没有垂直行距,但有一个小的缩进。在这些环境之外,必须没有缩进和正行距。这是当前代码的一个最小示例:

\documentclass{article}


\usepackage{amsthm}
\usepackage{parskip}

\theoremstyle{definition}
\newtheorem{Def}{Definition}[section]

\theoremstyle{remark}
\newtheorem{Exm}{Example}[section]

\theoremstyle{plain}
\newtheorem{Prop}{Proposition}[section]

\setlength{\parskip}{0.3cm plus 0.03cm minus 0.02cm}

\makeatletter
\def\thm@space@setup{%
  \thm@preskip=0.5cm plus 0.05cm minus 0.05cm
  \thm@postskip=0.2cm plus 0.02cm minus 0.01cm
}
\makeatother

\begingroup
    \makeatletter
    \@for\theoremstyle:=remark\do{%
        \expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
            \addtolength\thm@preskip\parskip
            }%
        }
\endgroup

\begin{document}

\section{Example}

\begin{Def}
This is a definition.

With two paragraphs.
\end{Def}

Running text.

\begin{Exm}
And an example.

Again with two paragraphs.
\end{Exm}

More running text.

This time with two paragraphs.

\begin{Prop}
Finally a proposition.

With two paragraphs.
\end{Prop}

\begin{proof}
Notice that it is clear.

And therefore it is so.
\end{proof}


\end{document}

然而我想要的是看起来像以下结果的东西,但这是自动完成的:

\documentclass{article}


\usepackage{amsthm}
\usepackage{parskip}

\theoremstyle{definition}
\newtheorem{Def}{Definition}[section]

\theoremstyle{remark}
\newtheorem{Exm}{Example}[section]

\theoremstyle{plain}
\newtheorem{Prop}{Proposition}[section]

\setlength{\parskip}{0.3cm plus 0.03cm minus 0.02cm}

\makeatletter
\def\thm@space@setup{%
  \thm@preskip=0.5cm plus 0.05cm minus 0.05cm
  \thm@postskip=0.2cm plus 0.02cm minus 0.01cm
}
\makeatother

\begingroup
    \makeatletter
    \@for\theoremstyle:=remark\do{%
        \expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
            \addtolength\thm@preskip\parskip
            }%
        }
\endgroup

\newcommand{\tab}{\hspace*{2em}}

\begin{document}

\section{Example}

\begin{Def}
This is a definition.
\\
\tab With two paragraphs.
\end{Def}

Running text.

\begin{Exm}
And an example.
\\
\tab
Again with two paragraphs.
\end{Exm}

More running text.

This time with two paragraphs.

\begin{Prop}
Finally a proposition.
\\
\tab
With two paragraphs.
\end{Prop}

\begin{proof}
Notice that it is clear.
\\
\tab
And therefore it is so.
\end{proof}


\end{document}

我还没有找到任何解决方案。任何帮助我都感激不尽。

答案1

我最终使用了类似下面的方法。解决方案比我预期的要简单,而且结果也很好。

\documentclass{article}


\usepackage{amsthm}
\usepackage{parskip}

\theoremstyle{definition}
\newtheorem{Def}{Definition}[section]

\theoremstyle{remark}
\newtheorem{Exm}{Example}[section]

\theoremstyle{plain}
\newtheorem{Prop}{Proposition}[section]

\setlength{\parskip}{0cm}
\setlength{\parindent}{0.5cm}
\setlength{\topsep}{0.35cm plus 0.2cm minus 0.2cm}

\makeatletter
\def\thm@space@setup{%
  \thm@preskip=0.45cm plus 0.3cm minus 0.16cm
  \thm@postskip=0.25cm plus 0.05cm minus 0.16cm
}
\makeatother

\begin{document}

...


\end{document}

相关内容