我目前正在尝试创建一个包含 4 个部分的假设。我首先声明了假设块,然后枚举其中的 A、B、C 和 D。然后我尝试为它们创建参考标签。示例代码如下,
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{enumitem}
\newtheorem{assumption}{Assumption}
\begin{document}
\begin{assumption}[The Assumptions]\label{assumption1}
We have the following four assumptions.
\begin{enumerate}[label={}]
\item \textbf{Part A:}
Assumption B goes here
\item \textbf{Part B:}
Assumption B goes here
\item \textbf{Part C:}
Assumption C goes here
\item \textbf{Part D:}
Assumption D goes here
\end{enumerate}
\end{assumption}
\end{document}
我希望能够为enumerate
区块中的每个项目添加标签,但遇到了困难。我想知道是否有办法使用上述方法来实现这一点,或者是否有更好的方法。谢谢。
答案1
你可以这样做:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{enumitem}
\newtheorem{assumption}{Assumption}
\begin{document}
\begin{assumption}[The Assumptions]\label{assumption1}
We have the following four assumptions.
\begin{enumerate}[label={\textbf{Part~\Alph*:}}, ref={assumption~\Alph*}]
\item \label{assump-A}%
Assumption A goes here
\item \label{assump-B}%
Assumption B goes here
\item \label{assump-C}%
Assumption C goes here
\item \label{assump-D}%
Assumption D goes here
\end{enumerate}
\end{assumption}
This is a reference to \ref{assump-B}. Now to \ref{assump-A}, etc.
\end{document}
如果您希望在引用中添加假设编号作为前缀(此处为 1,因为只有一个\begin{assumption}
),请使用:
\begin{enumerate}[label={\textbf{Part~\Alph*:}},
ref={assumption~\theassumption.\Alph*}]