如何标记物品

如何标记物品

是否可以按以下方式用乳胶标记物品:

我们有以下定理:

定理 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}

相关内容