仅缩进 newtheorem 的第一行

仅缩进 newtheorem 的第一行

我有许多假设,我通过定义 来包含它们newtheorem。我希望假设的第一行缩进,但无法实现这一目标。文本要么没有缩进,要么整个段落都是缩进。但我只需要包括“假设 No.X”的第一行缩进。

以下是 MWE:

\documentclass[a4paper, 12pt]{report}

\usepackage[ngerman]{babel}
\usepackage{geometry}
\usepackage{indentfirst}
\usepackage{ntheorem}
\usepackage{lipsum}

\geometry{outer=20mm, inner=25mm, top=20mm, bottom=30mm}

\theorembodyfont{\normalfont}
\theoremseparator{:}

\newtheorem{hyp}{Hypothese}

\begin{document}
\chapter{}
\lipsum
\begin{hyp}
Here should be Hypothesis number one with first line indented and the remaining text normally over the whole page.
\end{hyp}

\begin{hyp}
Here is another Hypothesis with an indented first line and remaining text like in the remaining thesis.
\end{hyp}
\end{document}

答案1

将缩进添加为定理标题字体的一部分,即\theoremheaderfont

在此处输入图片描述

\documentclass{report}

\usepackage{indentfirst}
\usepackage{ntheorem}
\usepackage{lipsum}

\theoremheaderfont{\hspace*{\parindent}\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{:}

\newtheorem{hyp}{Hypothesis}

\begin{document}

\chapter{A chapter}
\lipsum

\begin{hyp}
Here should be Hypothesis number one with first line indented and the remaining text normally over the whole page.
\end{hyp}

\begin{hyp}
Here is another Hypothesis with an indented first line and remaining text like in the remaining thesis.
\end{hyp}

\end{document}

答案2

我定义了一种新的定理样式,indenthead具有一个新的维度,\thmheadindent其工作原理如下\theoremindent

\documentclass[a4paper, 12pt]{report}

\usepackage[ngerman]{babel}
\usepackage{geometry}
\geometry{outer=20mm, inner=25mm, top=20mm, bottom=30mm}%%
\usepackage{indentfirst}
\usepackage{ntheorem}
\usepackage{lipsum}
\makeatletter
\newdimen{\thmheadindent}
\global\thmheadindent0cm
\newdimen\theorem@indent
\def\thm@headindent
        {\the\thmheadindent}
\newtheoremstyle{indenthead}%
  {\item[\hskip\labelsep\hskip\thm@headindent \theorem@headerfont ##1\ ##2\theorem@separator]}%
  {\item[\hskip\labelsep\hskip\thm@headinden \theorem@headerfont ##1\ ##2\ (##3)\theorem@separator]}
\makeatother

\theoremstyle{indenthead}

\theorembodyfont{\normalfont}
\theoremseparator{:}
\thmheadindent \parindent
\newtheorem{hyp}{Hypothese}


\begin{document}

\chapter{}

\lipsum[11]

\begin{hyp}
Here should be Hypothesis number one with first line indented and the remaining text normally over the whole page. T \end{hyp}

\begin{hyp}
Here is another Hypothesis with an indented first line and remaining text like in the remaining thesis.
\end{hyp}

\end{document} 

在此处输入图片描述

相关内容