是否可以按以下方式用乳胶标记物品:
我们有以下定理:
定理 3.2
(我)等等等等
(二)ble ble ble
(三)嘟嘟嘟嘟
因此我想将该项目命名为(II):
通过定理 3.2(II),我们很容易看出……
我可以在 latex 文件中写入任何命令,让“3.2 (II)”自动显示在 PDF 中吗?标准命令“\label、\ref”不能满足我的要求。
谢谢
答案1
希望这就是你要找的。借助enumitem
包,我们可以定义对项目的引用,以便\thethm (\Roman*)
包含定理数。
请注意,您必须更改\thethm
为用于定理的计数器。
梅威瑟:
\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}
\newtheorem{thm}{Theorem}[section]
\begin{document}
\section{Theorems}
\begin{thm}
We have the following theorem:
\begin{enumerate}[label=\upshape(\Roman*),ref=\thethm (\Roman*)]
\item\label{th:first} bla bla bla
\item\label{th:second} ble ble ble
\item\label{th:third} bli bli bli
\end{enumerate}
\end{thm}
We see easily by the theorem \ref{th:second} that...
\end{document}
输出
如果您需要在列表后立即添加定理标题,您可以将其添加before=\leavevmode
到环境选项中enumerate
。
\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}
\newtheorem{thm}{Theorem}[section]
\begin{document}
\section{Theorems}
We have the following theorem:
\begin{thm}
\begin{enumerate}[before=\leavevmode,label=\upshape(\Roman*),ref=\thethm (\Roman*)]
\item\label{th:first} bla bla bla
\item\label{th:second} ble ble ble
\item\label{th:third} bli bli bli
\end{enumerate}
\end{thm}
We see easily by the theorem \ref{th:second} that...
\end{document}
输出:
答案2
假设您使用的是“基本”文档类(例如article
),您可以按如下方式进行:
加载
ntheorem
包并选择在标题后插入换行符的定理样式,使用该
chngcntr
包确保定理的编号在每个新部分重新开始,并且重新设置低级 LaTeX 参数
\theenumi
、\labelenumi
和 ,\p@enumi
以适当获得直立形状的大写罗马数字,并在交叉引用中使用定理编号作为前缀。
\documentclass{article}
%% A. Theorem style with line break after header
\usepackage{ntheorem}
\theoremstyle{break}
\newtheorem{theorem}{Theorem}
%% B. Number theorems by section
\usepackage{chngcntr}
\counterwithin{theorem}{section}
%% C. Labelling of level-1 enumerated items
\renewcommand\theenumi{\textup{(\Roman{enumi})}}
\renewcommand\labelenumi{\theenumi}
\makeatletter
\renewcommand\p@enumi{\thetheorem\,}
\makeatother
\begin{document}
\setcounter{section}{3} % just for this example
\setcounter{theorem}{1}
\begin{theorem}
\begin{enumerate}
\item bla bla bla
\item \label{item:2} ble ble ble
\item bli bli bli
\end{enumerate}
\end{theorem}
As we can easily see by Theorem \ref{item:2}, \dots
\end{document}