
Я пытаюсь отформатировать многострочное выражение с меткой.
\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}