我有以下证明环境:
\begin{proof}
\leavevmode
\begin{enumerate}
\item[Case 1:] $3\mid n$. Then $n=3k$ for some integer $k$. Thus $n^2 = 9k^2 = 3(3k^2)$, and so $3\mid n^2$.
\item[Case 2:] $3\nmid n$. By the division algorithm, either $n=3k+1$ or $n = 3k+2$ for some integer k.
\begin{enumerate}
\item[Case 2a)] Suppose $n=3k+1$. Then $n^2 = (3k+1)^2 = 9k^2 + 6k + 1$ and so $n^2 = 3(3k^2 + 2k) + 1$. Therefore, $n^2 = 3m+1$ for some integer m, and so $n^2 - 1 = 3m$, thus $3\mid n^2 - 1$.
\item[Case 2b)] Suppose $n = 3k + 2$. Then $n^2 = (3k+2)^2 = 9k^2 + 12k + 4 = 3(3k^2+4k + 1) + 1$. $n^2 - 1 = 3(3k^2 +4k + 1)$, thus $3\mid n^2 -1$.
\end{enumerate}
\end{enumerate}
\end{proof}
其呈现效果如下:
我希望案例 1 和案例 2 与证明环境中的“证明”部分一致,但我所做的一切(包括使用 \indent 添加手动缩进)似乎都不起作用。我该怎么办?
答案1
如果你添加,showframe
你就会看到出了什么问题。
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{amsthm}
\usepackage{showframe}
\begin{document}
\begin{proof}
\leavevmode
\begin{enumerate}
\item[Case 1:] $3\mid n$. Then $n=3k$ for some integer $k$. Thus $n^2 = 9k^2 = 3(3k^2)$, and so $3\mid n^2$.
\item[Case 2:] $3\nmid n$. By the division algorithm, either $n=3k+1$ or $n = 3k+2$ for some integer k.
\begin{enumerate}
\item[Case 2a)] Suppose $n=3k+1$. Then $n^2 = (3k+1)^2 = 9k^2 + 6k + 1$ and so $n^2 = 3(3k^2 + 2k) + 1$. Therefore, $n^2 = 3m+1$ for some integer m, and so $n^2 - 1 = 3m$, thus $3\mid n^2 - 1$.
\item[Case 2b)] Suppose $n = 3k + 2$. Then $n^2 = (3k+2)^2 = 9k^2 + 12k + 4 = 3(3k^2+4k + 1) + 1$. $n^2 - 1 = 3(3k^2 +4k + 1)$, thus $3\mid n^2 -1$.
\end{enumerate}
\end{enumerate}
\end{proof}
\end{document}
使用enumitem
并记住\qedhere
(虽然添加一些结束语会更好)。
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{showframe}
\begin{document}
\begin{proof}
We divide our proof into cases.
\begin{enumerate}[label=Case \arabic*:,ref=\arabic*,leftmargin=*]
\item $3\mid n$. Then $n=3k$ for some integer $k$. Thus $n^2 = 9k^2 = 3(3k^2)$,
and so $3\mid n^2$.
\item \label{case2} $3\nmid n$. By the division algorithm, either $n=3k+1$ or
$n = 3k+2$ for some integer k.
\begin{enumerate}[label=Case \ref{case2}\alph*),leftmargin=2em]
\item Suppose $n=3k+1$. Then $n^2 = (3k+1)^2 = 9k^2 + 6k + 1$ and so
$n^2 = 3(3k^2 + 2k) + 1$. Therefore, $n^2 = 3m+1$ for some integer m,
and so $n^2 - 1 = 3m$, thus $3\mid n^2 - 1$.
\item Suppose $n = 3k + 2$. Then $n^2 = (3k+2)^2 = 9k^2 + 12k + 4 = 3(3k^2+4k + 1) + 1$.
$n^2 - 1 = 3(3k^2 +4k + 1)$, thus $3\mid n^2 -1$.\qedhere
\end{enumerate}
\end{enumerate}
\end{proof}
\end{document}