我使用 thmtools-package 创建了一个新的证明环境。使用以下代码我缩进整个环境:
\AtBeginEnvironment{prf}{
\patchcmd\@thm{\trivlist}{\list{}{\leftmargin25pt}}{}{}
\patchcmd\thmt@original@endprf{\endtrivlist}{\endlist}{}{}
}
现在的问题是,当我在此环境中有多个段落时,段落缩进不再可见 ( \setlength{\parindent}{25pt}
)。我该如何解决这个问题?
提前致谢。
这应该可以证明这个问题:
\documentclass[a4paper,12pt]{article}
\usepackage{etoolbox,amsthm,thmtools}
\declaretheoremstyle[
spaceabove=\topsep,
spacebelow=\topsep,
headformat={\NAME},
headfont=\bfseries,
notefont=\normalfont,
bodyfont=\normalfont,
headindent=0pt,
headpunct={\ },
qed =\qedsymbol
]{proof}
\declaretheorem[style=proof,name=Proof,numbered=no]{prf}
\makeatletter
\AtBeginEnvironment{prf}{%
\patchcmd\@thm{\trivlist}{\list{}{\leftmargin25pt}}{}{}
\patchcmd\thmt@original@endprf{\endtrivlist}{\endlist}{}{}
}
\makeatother
\setlength{\parindent}{25pt}
\begin{document}
\section{Section}
Some text\\
And more text
Here the paragraph is indented.
\begin{prf}
Some text\\
And more text
Here the paragraph is not (visibly) indented.
\end{prf}
\end{document}
答案1
只需通过设置参数恢复段落缩进\listparindent
:
\documentclass[a4paper,12pt]{article}
\usepackage{etoolbox,amsthm,thmtools}
\declaretheoremstyle[
spaceabove=\topsep,
spacebelow=\topsep,
headformat={\NAME},
headfont=\bfseries,
notefont=\normalfont,
bodyfont=\normalfont,
headindent=0pt,
headpunct={\ },
qed =\qedsymbol
]{proof}
\declaretheorem[style=proof,name=Proof,numbered=no]{prf}
\makeatletter
\AtBeginEnvironment{prf}{%
\patchcmd\@thm{\trivlist}{\list{}{\leftmargin25pt\listparindent\parindent}}{}{}
\patchcmd\thmt@original@endprf{\endtrivlist}{\endlist}{}{}
}
\makeatother
\setlength{\parindent}{25pt}
\begin{document}
\section{Section}
Some text\\
And more text
Here the paragraph is indented.
\begin{prf}
Some text\\
And more text
Here the paragraph is indented.
\end{prf}
\end{document}
答案2
该ntheorem
包与兼容thmtools
并且已经定义了\theoremindent
。在下面来自我的一个旧文件的示例中,我已经设置了\theoremindent{1cm}
,正如您所见,在证明环境中,段落缩进得以保留: