![证明环境 - “证明”后换行。](https://linux22.com/image/259310/%E8%AF%81%E6%98%8E%E7%8E%AF%E5%A2%83%20-%20%E2%80%9C%E8%AF%81%E6%98%8E%E2%80%9D%E5%90%8E%E6%8D%A2%E8%A1%8C%E3%80%82.png)
我想让 amsthm 包中的证明环境在“证明”之后自动添加换行符。
我尝试了以下代码,它也删除了 QED 符号,但是它不起作用:没有添加换行符。
\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.} \newline] }%\ignorespaces}
\makeatother
答案1
在校样标题后立即换行的手动方法是插入
$ $\newline
但可以在现有proof
定义的基础上进行构建,从而保留使用功能\qedhere
将“墓碑”移动到证明的实际最后一行的能力。
\documentclass{article}
\usepackage{amsmath,amsthm}
\newenvironment{myproof}[1][\proofname]{%
\begin{proof}[#1]$ $\par\nobreak\ignorespaces
}{%
\end{proof}
}
\begin{document}
\begin{proof}
$ $\newline
First line of my proof
Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}
\begin{myproof}[Proof of my theorem]
First line of my proof
Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{myproof}
\begin{myproof}
First line of my proof
Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{myproof}
\end{document}
答案2
我肯定会考虑ntheorem
为此打包;它有很多非常有用的预定义样式,包括break
最适合您的样式;请注意,这永远不会使您脱离Proof
其主体。
\theoremstyle{nonumberbreak}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theorembodyfont{}
\theoremheaderfont{\itshape}
\renewtheorem{proof}{Proof}
它还具有一个强大的算法来分配theoremmark
,它可以是任何您想要的符号。
\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,standard,thmmarks]{ntheorem}
\theoremstyle{nonumberbreak}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theorembodyfont{}
\theoremheaderfont{\itshape}
\renewtheorem{proof}{Proof}
\begin{document}
\begin{proof}
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
Your proof goes here
\end{proof}
\end{document}
如果你想进一步了解,你可能还想看看这里的问题和答案琐事清单终极指南;您将会看到,这一切都与拥有一个在新行上带有标题的环境有关(不会变得孤立)。
答案3
首先,我不会重新定义proof
环境。我只会自己定义。其次,您\newline
需要将位置放在方括号之外。这是一个工作示例:
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\makeatletter
\newenvironment{myproof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.} ]\mbox{}\par\nobreak}
{\popQED\endtrivlist\@endpefalse}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{myproof}
First line of my proof
Intermediary lines of my proof:
\lipsum[1]
last line of my proof
\end{myproof}
\end{document}
但由于\newline
段落缩进对我来说不太好看。因此,我建议将其更改\newline
为\par
强制段落分隔符。因此,新环境的代码将是
\makeatletter
\newenvironment{myproof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.} ]\mbox{}\par\nobreak}
{\popQED\endtrivlist\@endpefalse}
\makeatother
结果是
答案4
用一行总结你的证明,并在最后加上//。
因为不是每个人都愿意逐字逐句地阅读你的证明来了解你在说什么。
以下是一个例子:
\documentclass{article}
\usepackage{amsmath,amsthm}
\begin{document}
\begin{proof}
We prove it by contradiction.\\
Suppose the contrary that blablabla is not true, then blabla does not exists. Contradiction.]
\end{proof}
\end{document}