![帮助解决新环境中的不良错误](https://linux22.com/image/473412/%E5%B8%AE%E5%8A%A9%E8%A7%A3%E5%86%B3%E6%96%B0%E7%8E%AF%E5%A2%83%E4%B8%AD%E7%9A%84%E4%B8%8D%E8%89%AF%E9%94%99%E8%AF%AF.png)
我正在使用以下代码,它运行正常,但是当我包含环境以在证明后创建一行时会导致不良错误,但并非每次使用证明时都会出现错误,有什么帮助吗?
\documentclass{article}
\usepackage{parskip} %
\usepackage{tkz-euclide}%
\usepackage[top=1.0in, bottom=1.0in, left=1.0in, right=1.0in,a4paper]{geometry}%
\usepackage{amsmath,amsthm,amssymb}%
\usepackage{fancyhdr}%
\newtheorem{construction}{Construction}%
\newtheorem{theorem}{Theorem}[section]%
\newtheorem{corollary}{Corollary}[theorem]%
\newtheorem{lemma}[theorem]{Lemma}%
\newtheorem{definition}{Definition}%
\newtheorem{postulate}{Postulate}%
\newtheorem*{remark}{Remark}
\setlength{\parindent}{0em}%
\setlength{\parskip}{1em}%
%Diagram environment%
\newenvironment{diagram}
{%
\par\addvspace{10pt}%
\centering
\stepcounter{CountDiag}
\tkzSetUpCompass[lenth=1cm]
\begin{tikzpicture}
}{%
\end{tikzpicture}\par
\vspace{-5pt}
Diagram~\theCountDiag\par
\addvspace{10pt}
}
\newcounter{CountDiag}\counterwithin*{CountDiag}{section}%
%%%%%%%%%%%
\newcommand{\Ang}[1]{$\angle{#1}$}%
\newcommand{\Over}[1]{$\overline{#1}$}%
\newcommand{\Triangle}[1]{$\triangle{#1}$}%
\renewcommand\qedsymbol{QED}%
%new environment so line after the word proof%<--------Something goes wrong here
\makeatletter%
\renewenvironment{proof}[1][\proofname:]{\par%
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax%
\trivlist%
\item[\hskip\labelsep%
\itshape%
#1\@addpunct{.}]\mbox{}\\*%
}{%
%\popQED\endtrivlist\@endpefalse%
}%
\makeatother%
\begin{document}
\section{Proposition 47}
\begin{theorem}
In right-angled triangles the square on the side opposite the right angle equals the sum of the squares on the sides containing the right angle.
\end{theorem}
\textbf{Given:} Right-angled \Triangle{ABC} with \Ang{BAC} being the right angle.
\textbf{To be proved:} The square on \Over{BC} equals the sum of the squares on \Over{BA} and \Over{AC}.
\textbf{Construction:}
\begin{enumerate}
\item Describe the square $BDEC$ on \Over{BC}.
\item Describe the squares \Over{GB} and \Over{HC} on \Over{BA} and \Over{AC} respectively.
\item Draw \Over{AL} through $A$ parallel to either \Over{BD} or \Over{CE}.
\item Join \Over{AD} and \Over{FC}.
\end{enumerate}\hfill I.46, I.31, I.Post.1
\begin{diagram}[scale=0.5]
\tkzDefPoint(0,0){D}
\tkzDefPoint(5,0){E}
\tkzDefPoint(5,5){C}
\tkzDefPoint(0,5){B}
\tkzDrawPolygon(B,D,E,C)
\tkzLabelPoints[below left](D,E)
\tkzLabelPoints[below right](C)
\tkzLabelPoints[below left](B)
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}[scale=0.5]
\begin{scope}[rotate around={45:(current bounding box.center)}]
\tkzDefPoint(0,0){B}
\tkzDefPoint(3,0){A}
\tkzDefPoint(3,3){F}
\tkzDefPoint(0,3){G}
\tkzDrawPolygon(B,A,F,G)
\tkzLabelPoints[below left](B)
\tkzLabelPoints[right](F)
\tkzLabelPoints[above](G,A)
\end{scope}
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}[scale=0.5]
\begin{scope}[rotate around={45:(current bounding box.center)}]
\tkzDefPoint(0,0){C}
\tkzDefPoint(4,0){A}
\tkzDefPoint(4,4){H}
\tkzDefPoint(0,4){K}
\tkzDrawPolygon(C,A,H,K)
\tkzLabelPoints[below left](C)
\tkzLabelPoints[right](A)
\tkzLabelPoints[above](H,K)
\end{scope}
\end{diagram}
\begin{diagram}[scale=0.5]
\tkzDefPoint(0,0){B}
\tkzDefShiftPoint[B](5,0){C}
\tkzDefShiftPoint[B](2,3){A}
\tkzDefPoint(2,-5){L}
\tkzDefSquare(B,A)\tkzGetPoints{G}{F}
\tkzDefSquare(A,C)\tkzGetPoints{K}{H}
\tkzDefSquare(C,B)\tkzGetPoints{D}{E}
\tkzInterLL(A,L)(B,C) \tkzGetPoint{M}
\tkzDrawPolygon[fill=blue,opacity=0.5](A,B,C)
\tkzDrawPolygon[fill=gray,opacity=0.3](A,C,K,H)
\tkzDrawPolygon[fill=gray,opacity=0.3](C,B,D,E)
\tkzDrawPolygon[fill=gray,opacity=0.3](B,A,G,F)
\tkzLabelPoints(A,B,C,D,E,F,G,H,K,L,M)
\tkzDrawPoints(A,B,C,D,E,F,G,H,K,L)
\tkzDrawPoints[green](M)
\tkzDrawSegments[red](A,L F,C D,A A,E B,K)
\end{diagram}
\begin{proof}%
\begin{enumerate}%
\item If a straight line falling on two other straight lines makes the adjacent angles equal to two right angles, then the two straight lines are in a straight line with each other. \hfill Def.I.46
\item A square is a four-sided figure with all sides equal and all angles right angles.\hfill Def.I.22
\item A straight line can be drawn from any point to any point.\hfill I.Post.1
\item In a right-angled triangle, the side opposite the right angle is called the hypotenuse.\hfill I.Def.22
\item If a straight line is bisected and a straight line is added to it in a straight line, then the whole is greater.\hfill I.14
\item Since \Ang{BAC} and \Ang{BAG} are right angles, it follows that with the straight line \Over{BA}, the two straight lines \Over{AC} and \Over{AG} not lying on the same side make the adjacent angles equal to two right angles. $\therefore$, \Over{CA} is in a straight line with \Over{AG}. For the same reason, \Over{BA} is also in a straight line with \Over{AH}.
\item A square is a right-angled and equilateral parallelogram.\hfill I.Def.22
\item If a straight line falls on two straight lines and makes alternate angles equal, then the straight lines are parallel.\hfill I.Post.4
\item If equals are added to equals, then the wholes are equal.\hfill C.N.2
\item Since \Ang{DBC} equals \Ang{FBA}, for each is right, add \Ang{ABC} to each. $\therefore$, the whole \Ang{DBA} equals the whole \Ang{FBC}.
\item If equals are added to equals, then the wholes are equal.\hfill C.N.2
\item A square is a right-angled and equilateral parallelogram.\hfill I.Def.22
\item If equals are subtracted from equals, or equals are added to equals, the results are equal.\hfill I.4
\item Since \Over{DB} equals \Over{BC}, and \Over{FB} equals \Over{BA}, the two sides \Over{AB} and \Over{BD} equal the two sides \Over{FB} and \Over{BC} respectively, and \Ang{ABD} equals \Ang{FBC}. $\therefore$, the base \Over{AD} equals the base \Over{FC} and \Triangle{ABD} equals \Triangle{FBC}.
\item Now, the parallelogram $BDLM$ is double \Triangle{ABD}, for they have the same base \Over{BD} and are in the same parallels \Over{BD} and \Over{AL}. And the square $GFBA$ is double \Triangle{FBC}, for they again have the same base \Over{FB} and are in the same parallels \Over{FB} and \Over{GC}.
\item If a parallelogram and a triangle be on the same base and between the same parallels, then the parallelogram is double the triangle.\hfill I.41
\item $\therefore$, the parallelogram $BDLM$ also equals the square $GFBA$.
\item Similarly, if \Over{AE} and \Over{BK} are joined, the parallelogram $CMLE$ can also be proved equal to the square $HACK$. $\therefore$, the whole square $BDEC$ equals the sum of the two squares $GFBA$ and $HACK$.
\item If equals are added to equals, then the wholes are equal.\hfill C.N.2
\item And the square $BDEC$ is described on $BC$, and the squares $GFBA$ and $HACK$ on \Over{BA} and \Over{AC}.
\item $\therefore$, the square on $BC$ equals the sum of the squares on $BA$ and $AC$.
\textbf{Conclusion:} In right-angled triangles, the square on the side opposite the right angle equals the sum of the squares on the sides containing the right angle.
\end{enumerate}
\textbf{Q.E.D. (Quod Erat Demonstrandum):} The proof is complete.
\end{proof}
\clearpage
\section{Proposition 48}
\begin{theorem}
In triangle $ABC$, the square on side $BC$ equals the sum of the squares on sides $BA$ and $AC$.
\end{theorem}
\textbf{To prove:} $\angle BAC$ is a right angle.
\begin{proof}%
\textbf{Construction:} Draw \Over{AD} from point $A$ perpendicular to side \Over{AC}. Make \Over{AD} equal to \Over{BA} and join \Over{DC}.\hfill I.11, I.3,I.Post.1
\begin{diagram}
\tkzDefPoint(0,0){D}
\tkzDefPoint(5,0){B}
\tkzDefPoint(2.5,4){C}
\tkzDefMidPoint(D,B) \tkzGetPoint{A}
\tkzDrawPolygon(C,D,B)
\tkzDrawSegment(C,A)
\tkzLabelPoints(D,A,B)
\tkzLabelPoints[above](C)
\tkzFillPolygon[green, opacity=0.7](A,B,C)
\end{diagram}
\begin{itemize}
\item Since \Over{DA} equals \Over{AB} (by construction), the square on \Over{DA} equals the square on \Over{AB}.
\textbf{Addition of Squares:}
Add the square on \Over{AC} to both sides of the equation. Now, the sum of the squares on \Over{DA} and \Over{AC} equals the sum of the squares on \Over{BA} and \Over{AC}.\hfill C.N.2
\textbf{Claim:} The square on \Over{DC} equals the sum of the squares on \Over{DA} and \Over{AC}.
\item Since \Ang{DAC} is right (by construction), the square on \Over{DC} equals the sum of the squares on \Over{DA} and \Over{AC} (by the Pythagorean. Theorem).\hfill I.47, C.N.1
\textbf{Conclusion:}
Combining the two claims, the square on \Over{DC} equals the square on \Over{BC,} and $\therefore$, \Over{DC} equals \Over{BC}.
\textbf{Congruence:}
Since \Over{DA} equals \Over{AB}, \Over{AC} is common, and \Over{DC} equals \Over{BC}, the \Triangle{DAC} and \Triangle{BAC} are congruent (by Side-Angle- Side).
\textbf{Conclusion:}
Since \Ang{DAC} is a right angle, \Ang{BAC} is also a right angle (corresponding parts of congruent triangles are equal).
\textbf{$\therefore$} If in a triangle, the square on one side equals the sum of the squares on the remaining two sides, then the angle contained by the remaining two sides is right.
\end{itemize}
\end{proof}
\end{document}.
答案1
此处的这条消息(几乎总是)是由于错误\\
替换而导致的\\*
在定义中proof
而导致的,请\par\nopagebreak
参阅短语“段落中 \hbox 未满(不良程度 10000)”实际上是什么意思?