레이블을 사용하여 여러 줄 문 형식을 지정하는 방법

레이블을 사용하여 여러 줄 문 형식을 지정하는 방법

레이블이 있는 여러 줄 문 형식을 지정하려고 합니다.

\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}

여기에 이미지 설명을 입력하세요

관련 정보