为什么我的文档中的 amsthm 会崩溃?

为什么我的文档中的 amsthm 会崩溃?

我写了一个未完成的文档,并被建议使用 amsthm 包进行证明等,但是在使用它时,它删除了定义和定理之间的所有间距,为什么会这样?

如果您需要一个例子,我很乐意提供。

梅威瑟:

\documentclass[11pt, a4paper]{report}

\usepackage{amssymb}
\usepackage{amsthm}

\makeatletter
\renewenvironment{proof}[1][\normalfont\bfseries\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item\relax
        {\itshape
    #1\@addpunct{.}}\hspace\labelsep\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother

\renewcommand{\qedsymbol}{$\blacksquare$}  

\usepackage{enumitem}
\usepackage{parskip}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}[theorem]{Definition}


\begin{document}

\chapter{Introduction}
%\bigskip
%\smallskip
\section{Definitions and prerequisites}
Let us recall some basic knowledge, we begin by giving some definitions. 
%\medskip
\begin{definition} 
A group is a set $G$ together with a binary operation $*$ on $G$ satisfying
the following properties:
\begin{enumerate}[label=(G\arabic*),series=group]
\item Closure: $\forall x,y \in G, x * y \in G$.
\item Associativity: $\forall x,y, z \in G, (x * y) * z = x * (y * z)$.
\item Identity: There is an element $e \in G$ such that $e * x = x * e = x$ for all $x \in G$.
\item Inverses: For any $x \in G$ there is an element $y \in G$ such that $x * y = y * x = e$.
\end{enumerate}
\end{definition}

\begin{proof}
\begin{enumerate}[label=(\roman*)]
\item Let $W_1$ and $W_2$ be the kernel and image of $f$. Note that the kernel and image of $f$ are both invariant subspaces. For the kernel with $x \in W_1$, if $f(x)=0$, then $f\rho_s^1(x) = \rho_s^2f(x)=0$ so $\rho_s^1(x) \in W_1$. By irreducibility, $W_1$ is trivial or the whole space. We neglect the first case as it implies $f=0$ which is trivial. By virtue of the same argument presented above we can conclude the image $W_2$ is equal to $V_2$. Since by assumption $f \neq 0$ we have $W_1 = 0$ and $W_2 = V_2$ which shows $f$ is an isomorphism.
\item $f$ has a non-zero eigenvalue(there exits at least one, since the field of scalars is the field of complex numbers). The map $\hat{f} = f - \lambda I$ satisfies $\rho_s^2 \circ \hat{f} = \hat{f} \circ \rho_s^1$ and has a non-trivial kernel so $\hat{f} = 0$.\qedhere
\end{enumerate}
\end{proof}

\end{document}

答案1

parskip和包amsthm之间的交互很差,你可以用@egregs 的技巧来解决这个问题,很好的答案https://tex.stackexchange.com/a/22130/36296

parskip或者,如果您不需要该包,您可以将其省略。

\documentclass[11pt, a4paper]{report}

\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{parskip}

\makeatletter
\renewenvironment{proof}[1][\normalfont\bfseries\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item\relax
        {\itshape
    #1\@addpunct{.}}\hspace\labelsep\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}

\def\thm@space@setup{%
  \thm@preskip=2\parskip \thm@postskip=0pt
}
\makeatother

\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\chapter{Introduction}
%\bigskip
%\smallskip
\section{Definitions and prerequisites}
Let us recall some basic knowledge, we begin by giving some definitions. 
%\medskip
\begin{definition} 
A group is a set $G$ together with a binary operation $*$ on $G$ satisfying
the following properties:
\begin{enumerate}[label=(G\arabic*),series=group]
\item Closure: $\forall x,y \in G, x * y \in G$.
\item Associativity: $\forall x,y, z \in G, (x * y) * z = x * (y * z)$.
\item Identity: There is an element $e \in G$ such that $e * x = x * e = x$ for all $x \in G$.
\item Inverses: For any $x \in G$ there is an element $y \in G$ such that $x * y = y * x = e$.
\end{enumerate}
\end{definition}

\begin{proof}
\begin{enumerate}[label=(\roman*)]
\item Let $W_1$ and $W_2$ be the kernel and image of $f$. Note that the kernel and image of $f$ are both invariant subspaces. For the kernel with $x \in W_1$, if $f(x)=0$, then $f\rho_s^1(x) = \rho_s^2f(x)=0$ so $\rho_s^1(x) \in W_1$. By irreducibility, $W_1$ is trivial or the whole space. We neglect the first case as it implies $f=0$ which is trivial. By virtue of the same argument presented above we can conclude the image $W_2$ is equal to $V_2$. Since by assumption $f \neq 0$ we have $W_1 = 0$ and $W_2 = V_2$ which shows $f$ is an isomorphism.
\item $f$ has a non-zero eigenvalue(there exits at least one, since the field of scalars is the field of complex numbers). The map $\hat{f} = f - \lambda I$ satisfies $\rho_s^2 \circ \hat{f} = \hat{f} \circ \rho_s^1$ and has a non-trivial kernel so $\hat{f} = 0$.\qedhere
\end{enumerate}
\end{proof}

\end{document}

在此处输入图片描述

答案2

amsthm覆盖定理的默认样式。

但是,您可以使用以下语法自定义它们

\newtheoremstyle{note}% style name 
{2ex}% above space 
{2ex}% below space 
{}% body font 
{}% indent amount 
{\scshape}% head font 
{.}% post head punctuation 
{\newline}% post head punctuation 
{}% head spec 

\theoremstyle{note} 
\newtheorem{scnote}{Note} 

然后在文档中使用:

\begin{scnote} 
This is an example of a theorem-like environment. 
\end{scnote}

当然你也可以scnote用任何你想要的东西来代替。


该示例来自https://www.dickimaw-books.com/latex/thesis/html/amsthm.html

相关内容