定義の終わりを示す

定義の終わりを示す

次のようにパッケージを使用して環境amsthmを定義していますdefinition

\theoremstyle{definition}
\newtheorem{definition}{Definition}

驚いたことに、定義がどこで終わり、次のテキストがどこで始まるのかを示す印刷上の表示はほとんど提供されていません (新しい段落がありますが、特に定義が方程式で終わる場合は、これでは明らかに不十分です)。

これをもっと明確にするにはどうすればいいでしょうか? 定義テキストを通常のテキストと異なるフォントにしたくありません。 定義は、証明のように、次のようなもので終わるべきかもしれません\qedsymbol。 これを追加するにはどうすればいいでしょうか?

答え1

amsthmそれ自体は最高ではないが、thmtoolsamsthmおよびその他の定理パッケージに非常に優れた「フロントエンド」を提供します。

特に、にはとthmtoolsが含まれており、必要に応じて使用できます。以下は、と を組み合わせて、単純な水平線で例を終える小さな使用例です。これは、必要に応じて簡単に調整できます。たとえば、これを と組み合わせることができます。prefoothookpostfoothookthmtoolsamsthmtcolorbox本当に凝ったボックスの場合は、「例の終了」というテキストを右揃えにすることもできます。

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
  headfont=\normalfont\scshape,
  numbered=unless unique,
  bodyfont=\normalfont,
  spaceabove=1em plus 0.75em minus 0.25em,
  prefoothook=\newline\rule{\linewidth}{1pt},
  spacebelow=1em plus 0.75em minus 0.25em,
]{exmpstyle}

\declaretheorem[
  style=exmpstyle,
  title=Example,
  refname={example,examples},
  Refname={Example,Examples}
]{exmp}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut pustibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum uris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, nec vehicula augue eu
neque. Pellentesque habitant morbi tristique t netus et malesuada fames ac
turpis egestas. Mauris ut leo.
\begin{exmp}
  \lipsum*[1]
\end{exmp}
\lipsum[2-3]
\begin{exmp}
  \lipsum*[4]
\end{exmp}
\end{document}

出力は次のようになります。

出力

補遺

Caramdir が言及し、コメントで Barbara Beeton がリクエストしたように、方程式を操作してオプションを使用する例を次に示しますqed

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
  headfont=\normalfont\bfseries\itshape,
  numbered=unless unique,
  bodyfont=\normalfont,
  spaceabove=1em plus 0.75em minus 0.25em,
  spacebelow=1em plus 0.75em minus 0.25em,
  qed={\itshape That's All Folks!},
]{exmpstyle2}

\declaretheorem[
  style=exmpstyle2,
  title=Example,
  refname={example,examples},
  Refname={Example,Examples}
]{exmp2}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut pustibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum uris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, nec vehicula augue eu
neque. Pellentesque habitant morbi tristique t netus et malesuada fames ac
turpis egestas. Mauris ut leo.
\begin{exmp2}
  \lipsum*[1]
\end{exmp2}
\lipsum[2-3]
\begin{exmp2}
  \lipsum*[4]
  \begin{equation*}
    \mathcal{L} = \overline \psi (i \gamma \cdot \partial - m) \psi
    \qedhere
  \end{equation*}
\end{exmp2}
\end{document}

これにより、次のようになります。

出力2

答え2

本当に必要性を感じません。でも、あなたが尋ねているのなら、

\documentclass{article}
\usepackage{amsthm}

\usepackage{lipsum}

\theoremstyle{definition}
\newtheorem{defi/}{Definition}

\newenvironment{defi}
  {\renewcommand{\qedsymbol}{$\heartsuit$}%
   \pushQED{\qed}\begin{defi/}}
  {\popQED\end{defi/}}

\begin{document}

\lipsum[2]

\begin{defi}
This is the definition of \emph{definition}.
\end{defi}

\lipsum[3]

\begin{defi}
This is the definition of recursion,
\[
x\gets x+1 \qedhere
\]
\end{defi}

\lipsum[2]

\end{document}

ここに画像の説明を入力してください

定義の途中に証明がないものと仮定します。

答え3

thmboxパッケージのような環境を表示するための優れた方法を提供しますtheorem

たとえば、3 つの定義済みスタイルを使用すると、次のことが可能になります。

\documentclass{article}
\usepackage{mathtools}
\usepackage{thmbox} % Overrides \newtheorem command! See [nothm] to disable this feature.
\usepackage{lipsum} % Useless, just for the demo.

\newtheorem[S, bodystyle=\normalfont\noindent]{defiS}{Definition}[section]
\newtheorem[M]{defiM}{Definition}[section]
\newtheorem[L]{defiL}{Definition}[section]

\begin{document}

\section{My nice demo}

\begin{defiS}[Inverse of a relation]
  Let \(R\) be a relation, \emph{the inverse of \(R\)} is
  \[R^{-1} = \{(x,y) \mid (y, x) \in R\}\]
\end{defiS}

\lipsum[2] % Just for the demo

\begin{defiM}[Union]
  Let \(R\) and \(S\) be relations, the \emph{union of \(R\) and \(S\)} is defined as
  \[
  R \cup S = \{(x, y) \mid (x,y) \in R \text{ or } (x,y) \in S\}
  \]
\end{defiM}

\lipsum[1] % Just for the demo

\begin{defiL}[Graph of a function]
  Let \(f\) be a fuction, the \emph{graph of \(f\)}  is
  \[
  \langle f \rangle = \{(x, y) \mid f x = y\}
  \]
\end{defiL}

\end{document}

ここに画像の説明を入力してください

以下の点にご注意ください:

  • 最初の例(環境)normalfontのみ、フォントを(つまり、傾斜していない)に設定しました。defiS
  • 3 つの異なる環境 (つまりdefiS、、 )を使用したため、3 つのケースの番号は 1.1 になっていますが、1 つの環境に固執すれば、番号は正しくなります (つまり、1.1、1.2、1.3 など)。defiMdefiL
  • 定義済みのスタイルを使用しましたが、さまざまなスタイルをカスタマイズできます。

答え4

1 つの解決策は、証明全体を (指定された量だけ) インデントし、フォント サイズを少し変更することです。環境を次のように再定義することを検討できますproof

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont\small\topsep6\p@\@plus6\p@\relax
%\trivlist %%%% old
\list{}{\leftmargin=\parindent
   \rightmargin=0pt
   \settowidth{\itemindent}{\itshape#1}%
   \labelwidth=\itemindent}  
\item[\hskip\labelsep\itshape#1\@addpunct{.}]\ignorespaces
}{%
 \popQED
 %\endtrivlist %%OLD
 \endlist %%NEW
 \@endpefalse
}
\makeatother

関連情報