假设1. (一)某物1,(二)某物2。
我想将单独的部分称为 1(i) 和 1(ii)。有什么办法吗?我想我可以使用枚举和三个标签,即标签 1 表示假设 1、标签 2 表示 (i) 和标签 3 表示 (iii)。但是,在这种情况下,我会使用 \ref{label1}\ref{label2}。然而,这是两个独立的对象。有什么办法可以将它们合并为一个对象吗?
\documentclass[12pt]{article}
\usepackage{amsthm}
\newtheorem{asu}{Assumption}
\begin{document}
\begin{asu} \label{asu1}
(i) something1, (ii) something2
\end{asu}
Now I refer to it manually, i.e. assumption \ref{asu1}(i). However, this is not the way to go.
\end{document}
答案1
下面我定义了一个新的计数器,它会随着每个假设而重置。此外,\subasu
它还以\item
类似方式用于打印假设编号,可以对其进行\label
-ed 和\ref
-erenced:
\documentclass{article}
\usepackage{amsthm}
\newtheorem{asu}{Assumption}
\newcounter{subassumption}[asu]
\renewcommand{\thesubassumption}{(\textit{\roman{subassumption}})}
\makeatletter
\renewcommand{\p@subassumption}{\theasu}% Counter prefix.
\makeatother
\newcommand{\subasu}{% Just like \item in a list, but for an asu
\refstepcounter{subassumption}%
\thesubassumption~\ignorespaces}
\begin{document}
\begin{asu}\label{asu1}
\subasu \label{asu1i} something1, \subasu \label{asu1ii} something2
\end{asu}
Now I refer to it autmoatically, i.e. assumption~\ref{asu1ii} or~\ref{asu2i}.
\begin{asu}\label{asu2}
\subasu \label{asu2i} something1, \subasu \label{asu2ii} something2
\end{asu}
\end{document}