縮排環境內的段落縮排

縮排環境內的段落縮排

我已經使用 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

該包ntheoremthmtools.\theoremindent在我的舊文件的以下範例中,我設定了\theoremindent{1cm}並且如您所見,在證明環境中,保留了段落縮排:

在此輸入影像描述

相關內容