ラベルを使用して複数行のステートメントをフォーマットする方法

ラベルを使用して複数行のステートメントをフォーマットする方法

複数行のステートメントをラベルでフォーマットしようとしています。

\documentclass{article}

\usepackage{amsmath}
\usepackage[showframe,pass]{geometry}

\begin{document}

Let $P(n)$ denote the statement that
\begin{equation}
\text{The sum of the natural numbers less than or equal to $n$ is given by the formula }
0 + 1 + \cdots + n = \frac{n(n+1)}{2}.
\tag{P(n)}
\end{equation}

\end{document}

コード出力

align残念ながら、この文は右余白からはみ出しています。水平方向の配置が正しくないため、 、multline、環境の使用は適切ではないと思いますgather。数式をどのようにフォーマットすればよいでしょうか?

欲しいもの:

  • 環境と同じようにステートメントをインデントしたいと思いますquote
  • ラベルを、現在の出力にある「(P(n))」ではなく「P(n)」にしたい

答え1

これはテキストなので、そのように扱う必要があります。

\documentclass{article}

\usepackage{amsmath}
\usepackage[showframe,pass]{geometry}
\usepackage{lipsum}

\begin{document}

\lipsum[2]

Let $P(n)$ denote the statement that
\[
\begin{minipage}{0.75\textwidth}
The sum of the natural numbers less than or equal to $n$ is given by the formula
$0 + 1 + \cdots + n = \frac{n(n+1)}{2}$.
\end{minipage}
\tag{$P(n)$}
\]
\lipsum[3]

\end{document}

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

(いずれの場合も数式モードに注意してください)を使用すると\tag*{$P(n)$}、括弧なしのタグが取得されます。

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

答え2

gathered環境の中に環境を使うこともできますequation

Let $P(n)$ denote the statement that
\begin{equation}
  \begin{gathered}
    \text{The sum of the natural numbers less than or equal to $n$}\\
      \text{is given by the formula $0 + 1 + \cdots + n = \frac{n(n+1)}{2}$.}
  \end{gathered}
  \tag*{P(n)}
\end{equation}

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

関連情報