我正在为我的论文准备定理环境的设置。我想在我的文档中有 200 个这样的环境之前完成此操作,因为更改它们可能会在那个阶段破坏一切。
我想要的是:
cleveref
. 要使用大写/小写引用,复数形式也一样thmtools
因为它提供了一个接口来cleveref
定义复数名称- 正确放置结束标记。因此,结束标记应与文本的最后一行出现在同一行(即使它是 displaymath 或
itemize
/enumerate
)
看来,这很难做好。ntheorem
很擅长将标记放在正确的位置,但我无法ntheorem
正确地使用thmtools
。
目前我已将thmtools
用作amsthm
后端。它与 配合得很好cleveref
。
我有这样的定义
\declaretheorem[sibling=equation,qed=\text{\guillemotleft}]{definition}
但是当我用列表结束我的定义时,guillemet («) 被放在新行上。显然不是我想要的 (-;
当我切换后端时,ntheorem
我得到了以下形式的编译错误
\declaretheorem key `qed' not known.
有人有解决这个问题的方法吗?
一位 MWE 表示:
\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage{thmtools}
\numberwithin{equation}{section}
\declaretheoremstyle[
headformat={\makebox[0pt][r]{\NUMBER\quad}\NAME \NOTE}
]{theorem}
\declaretheoremstyle[
headformat={\makebox[0pt][r]{\NUMBER\quad}\NAME \NOTE}
]{definition}
\declaretheorem[style=theorem,sibling=equation]{theorem}
\declaretheorem[style=theorem,sibling=equation]{proposition}
\declaretheorem[style=theorem,sibling=equation]{lemma}
\declaretheorem[style=definition,sibling=equation,qed=\text{\guillemotleft}]{definition}
\declaretheorem[style=definition,sibling=equation,qed=\text{\guillemotleft}]{exercise}
\declaretheorem[style=definition,sibling=equation,qed=\text{\guillemotleft}]{example}
\let\proof\relax
\declaretheorem[style=definition,numbered=no,qed=\qedsymbol]{proof}
%% Math macro stuff to make this compile
\DeclareMathOperator{\Spec}{Spec} % Spectrum
\DeclareMathOperator{\M}{M}
\DeclareMathOperator{\Ga}{Ga}
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\Gm}{Gm}
\def\ol{\overline}
\begin{document}
\begin{definition}
A \emph{group variety over $k$} is an integral group scheme of finite type over $\Spec k$.
\end{definition}
\begin{example}
Let $k$ be a field and $R$ a commutative $k$-algebra.
\begin{itemize}
\item The varieties $\Ga_{k} = \Spec k[x]$ and $\Gm_{k} = \Spec k[x,y]/(xy - 1)$ are group varieties. Indeed, $\Ga_{k}(R)$ is the additive group underlying $R$, and $\Gm_{k}(R) = R^*$ is the group of units in $R$.
\item The variety $\M_{n,k} = \Spec k[(x_{ij})_{ij}]$ is a group variety. Also the closed sub variety $\GL_{n,k}$ defined by the polynomial $\det \left( (x_{ij})_{ij} \right) - 1$ is a group variety. The $R$-valued points are the $n \times n$-matrices $\M_{n,k}(R)$ with coefficients in $R$, and $\GL_{n,k}(R)$ consists of the invertible matrices respectively. Observe that $\Gm_{k} = \GL_{1,k}$.
\item The variety $\mu_{n,k} = \Spec k[x]/(x^n -1)$ is a group variety, and $\mu_{n,k}(R)$ consists of the group of $n$-th roots of unity in $R$.
\item An elliptic curve over $k$ is defined as a proper variety $E/k$ that is smooth of relative dimension $1$, of which the geometric fibre $E_{\ol{k}}$ has genus $1$, together with a given point $0 \in E(k)$. It can be shown that every elliptic curve is a group variety. Actually they form an important class of objects in the study of abelian varieties.
\end{itemize}
\end{example}
\end{document}
请注意,定义的结束标记是可以的,但示例的结束标记却位于其自身的一行上。
答案1
如果您想使用ntheorem
而不是amsthm
作为后端,那么您将不得不放弃一些可用的格式化功能,amsthm
并且必须进行一些其他更改:
命令
\NAME
、\NUMBER
和\NOTE
将不再可用。为了模拟所需的头部格式,您可以使用该
headformat=swapnumber
选项,但这样您就失去了更改头部格式的灵活性。qed=\text{\guillemotleft}
必须使用 in\declaretheoremstyle
而不是 in选项\declaretheorem
(无论如何,这都是有意义的)。您的
proof
环境必须单独定义。
下面是使用以下方式定义的一个例子ntheorem
:
\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath, amssymb}
\usepackage[thmmarks,amsmath]{ntheorem}
\usepackage{thmtools}
\numberwithin{equation}{section}
\declaretheoremstyle[headformat=swapnumber,bodyfont=\normalfont]{theorem}
\declaretheoremstyle[headformat=swapnumber,bodyfont=\normalfont
,qed=\text{\guillemotleft}]{mydefinition}
\declaretheorem[style=theorem,sibling=equation]{theorem}
\declaretheorem[style=theorem,sibling=equation]{proposition}
\declaretheorem[style=theorem,sibling=equation]{lemma}
\declaretheorem[style=mydefinition,sibling=equation]{definition}
\declaretheorem[style=mydefinition,sibling=equation]{exercise}
\declaretheorem[style=mydefinition,sibling=equation]{example}
\newtheorem*{proof}{Proof}
%% Math macro stuff to make this compile
\DeclareMathOperator{\Spec}{Spec} % Spectrum
\DeclareMathOperator{\M}{M}
\DeclareMathOperator{\Ga}{Ga}
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\Gm}{Gm}
\def\ol{\overline}
\begin{document}
\begin{definition}
A \emph{group variety over $k$} is an integral group scheme of finite type over $\Spec k$.
\end{definition}
\begin{proof}
Test
\end{proof}
\begin{example}
Let $k$ be a field and $R$ a commutative $k$-algebra.
\begin{itemize}
\item The varieties $\Ga_{k} = \Spec k[x]$ and $\Gm_{k} = \Spec k[x,y]/(xy - 1)$ are group varieties. Indeed, $\Ga_{k}(R)$ is the additive group underlying $R$, and $\Gm_{k}(R) = R^*$ is the group of units in $R$.
\item The variety $\M_{n,k} = \Spec k[(x_{ij})_{ij}]$ is a group variety. Also the closed sub variety $\GL_{n,k}$ defined by the polynomial $\det \left( (x_{ij})_{ij} \right) - 1$ is a group variety. The $R$-valued points are the $n \times n$-matrices $\M_{n,k}(R)$ with coefficients in $R$, and $\GL_{n,k}(R)$ consists of the invertible matrices respectively. Observe that $\Gm_{k} = \GL_{1,k}$.
\item The variety $\mu_{n,k} = \Spec k[x]/(x^n -1)$ is a group variety, and $\mu_{n,k}(R)$ consists of the group of $n$-th roots of unity in $R$.
\item An elliptic curve over $k$ is defined as a proper variety $E/k$ that is smooth of relative dimension $1$, of which the geometric fibre $E_{\ol{k}}$ has genus $1$, together with a given point $0 \in E(k)$. It can be shown that every elliptic curve is a group variety. Actually they form an important class of objects in the study of abelian varieties.
\end{itemize}
\end{example}
\end{document}
答案2
呃,这是一个不起作用的例子。
第一个问题:\def\ol\overline
因“缺失”而导致失败\begin{document}
;请使用括号括起来进行纠正\overline
。
第二个问题:“\guillemotleft
编码 OT1 时命令不可用”。
无论如何,该命令\qedhere
是在 2003 年开发的,amsthm
用于解决当证明以显示或列表结束时的“换行”问题;它必须在\end{...}
嵌入元素(equation
和朋友或itemize
)的命令之前输入。碰巧的是,thmtools
这也适用于定理类对象,但如果您想要预定义框以外的符号,则必须重新定义\qedsymbol
我对不是很熟悉ntheorem
,但知道它在一些重要方面与有所不同amsthm
,因此如果您想使用thmtools
,ntheorem
则需要参考thmtools
手册。