如何创建一个枚举环境,使人们能够将枚举与定理环境等同起来?
例子:
定义1.1 假设 X 是一个集合。X 上的代数是 X 子集的集合 C,满足
1.1.1如果 A 是 C 的一个元素,则 X\A 也是 C 的一个元素;
1.1.2如果 A 和 B 都是 C 的元素,那么并集 AUB 也是 C 的元素。
命题 1.1假设 C 是集合 X 上的代数;则以下句子为真
1.1.1空集是C的一个元素;
1.1.2集合X是C的一个元素;
1.1.3C 的每个元素的有限并集都是 C 的一个元素;
1.1.4C 元素的每个有限交集都是 C 的元素。
如果我能将其标记出来以便以后参考的话,那将会非常有用。
答案1
这是一个可能的解决方案,使用枚举项包定义一个新的列表类环境,其标签使用变量前缀;该前缀由宏控制,在包的帮助下etoolbox
,定理类环境被修补以重新定义前缀。然后像往常一样进行标记和交叉引用项目。
根据芭芭拉·比顿的评论,规定标签末尾要有句号,而交叉引用则不用句号。此外,斜体项目编号也被删除。
\documentclass{book}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{etoolbox}
\newtheorem{prop}{Proposition}[chapter]
\theoremstyle{definition}
\newtheorem{defi}{Definition}[chapter]
\newcommand\EnumPrefix{}
\newlist{senenum}{enumerate}{10}
\setlist[senenum]{label=\EnumPrefix.,ref=\EnumPrefix,leftmargin=*}
\AtBeginEnvironment{defi}{\renewcommand\EnumPrefix{\normalfont\bfseries D.\thedefi.\arabic*}}
\AtBeginEnvironment{prop}{\renewcommand\EnumPrefix{\normalfont\bfseries P.\theprop.\arabic*}}
\begin{document}
\chapter{Test Chapter}
\begin{defi}
Let $X$ be a set. An algebra over $X$ is a collection $C$ of subsets of $X$ satisfying
\begin{senenum}
\item If $A$ is an element of $C$, then $X\setminus A$ is an element of $C$;
\item If $A$ and $B$ are both elements of $C$, then the union $A\cup B$ is an element of $C$.
\end{senenum}
\end{defi}
\begin{prop}
Let $C$ be an algebra over a set $X$; then the following senteces are true
\begin{senenum}
\item\label{ite:algempty} The empty set is an element of $C$;
\item The set $X$ is an element of $C$;
\item Every finite union of elements of $C$ is an element of $C$;
\item\label{ite:alginter} Every finite intersection of elements of $C$ is an element of $C$.
\end{senenum}
\end{prop}
In the proof of the equivalence of \ref{ite:alginter} and \ref{ite:algempty}, we used,...
\end{document}
上述方法侧重于列表类环境,因此在ntheorem
用于定义类定理结构(ntheorem
在定理编号末尾不使用默认句点)的情况下,它可以直接使用(只需进行微小更改):
\documentclass{book}
\usepackage{ntheorem}
\usepackage{enumitem}
\usepackage{etoolbox}
\newtheorem{prop}{Proposition}[chapter]
\theoremstyle{changebreak}
\newtheorem{defi}{Definition}[chapter]
\newcommand\EnumPrefix{}
\newlist{senenum}{enumerate}{10}
\setlist[senenum]{label=\EnumPrefix,leftmargin=*}
\AtBeginEnvironment{defi}{\renewcommand\EnumPrefix{\normalfont\bfseries D.\thedefi.\arabic*}}
\AtBeginEnvironment{prop}{\renewcommand\EnumPrefix{\normalfont\bfseries P.\theprop.\arabic*}}
\begin{document}
\chapter{Test Chapter}
\begin{defi}
Let $X$ be a set. An algebra over $X$ is a collection $C$ of subsets of $X$ satisfying
\begin{senenum}
\item If $A$ is an element of $C$, then $X\setminus A$ is an element of $C$;
\item If $A$ and $B$ are both elements of $C$, then the union $A\cup B$ is an element of $C$.
\end{senenum}
\end{defi}
\begin{prop}
Let $C$ be an algebra over a set $X$; then the following senteces are true
\begin{senenum}
\item\label{ite:algempty} The empty set is an element of $C$;
\item The set $X$ is an element of $C$;
\item Every finite union of elements of $C$ is an element of $C$;
\item\label{ite:alginter} Every finite intersection of elements of $C$ is an element of $C$.
\end{senenum}
\end{prop}
In the proof of the equivalence of \ref{ite:alginter} and \ref{ite:algempty}, we used,...
\end{document}
使用时ntheorem
,甚至还有另一种选择,不需要包,etoolbox
因为\theoremprework
可以用来适当地重新定义用于列表式环境的前缀(如建议的那样休斯在对原始问题的评论中);下面是与此方法相对应的代码,产生的结果与之前相同:
\documentclass{book}
\usepackage{ntheorem}
\usepackage{enumitem}
\newcommand\EnumPrefix{}
\theoremprework{\renewcommand\EnumPrefix{\normalfont\bfseries P.\theprop.\arabic*}}
\newtheorem{prop}{Proposition}[chapter]
\theoremstyle{changebreak}
\theoremprework{\renewcommand\EnumPrefix{\normalfont\bfseries D.\thedefi.\arabic*}}
\newtheorem{defi}{Definition}[chapter]
\newlist{senenum}{enumerate}{10}
\setlist[senenum]{label=\EnumPrefix,leftmargin=*}
\begin{document}
\chapter{Test Chapter}
\begin{defi}
Let $X$ be a set. An algebra over $X$ is a collection $C$ of subsets of $X$ satisfying
\begin{senenum}
\item If $A$ is an element of $C$, then $X\setminus A$ is an element of $C$;
\item If $A$ and $B$ are both elements of $C$, then the union $A\cup B$ is an element of $C$.
\end{senenum}
\end{defi}
\begin{prop}
Let $C$ be an algebra over a set $X$; then the following senteces are true
\begin{senenum}
\item\label{ite:algempty} The empty set is an element of $C$;
\item The set $X$ is an element of $C$;
\item Every finite union of elements of $C$ is an element of $C$;
\item\label{ite:alginter} Every finite intersection of elements of $C$ is an element of $C$.
\end{senenum}
\end{prop}
In the proof of the equivalence of \ref{ite:alginter} and \ref{ite:algempty}, we used,...
\end{document}