![如何获取多层列表中项目交叉引用的最后一个字符?](https://linux22.com/image/474837/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E5%A4%9A%E5%B1%82%E5%88%97%E8%A1%A8%E4%B8%AD%E9%A1%B9%E7%9B%AE%E4%BA%A4%E5%8F%89%E5%BC%95%E7%94%A8%E7%9A%84%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E5%AD%97%E7%AC%A6%EF%BC%9F.png)
假设我们有以下代码:
\documentclass[reqno]{amsart}
\usepackage{amsaddr}
\usepackage{geometry}
\geometry{margin=1in,top=3cm}
\usepackage{amssymb}
\usepackage{microtype}
\usepackage{listings}
\newtheorem{thm}{Theorem}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}[definition]
\newtheorem{note}[thm]{Note}
\begin{document}
\section{Section 1}
\begin{definition}
Definition 1
\end{definition}
\section{Section 2}
\begin{definition}
Definition 2
\end{definition}
\begin{definition}
Definition 3
\end{definition}
\section{Section 3}
\begin{definition}
Definition 4
\end{definition}
\begin{definition}
Definition 5
\end{definition}
\begin{definition}\label{def:6}
Definition 6
\begin{enumerate}
\item djdj
\begin{enumerate}
\item jffj
\item krlf
\item krfk
\begin{enumerate}
\item dkdk
\item krkd
\item keld
\item shsj
\item krlf
\end{enumerate}
\item skxk \label{crit:d}
\begin{enumerate}
\item jddj \label{crit:di}
\end{enumerate}
\item kssk
\end{enumerate}
\item skdk
\item krdk
\end{enumerate}
\end{definition}
\section{Label of Criteria In The List of def. \ref{def:6}}
See sec. \ref{def:6}, crit. \ref{crit:d} \ref{crit:di}
\end{document}
问题:交叉引用时sec. 3, def. 6 crit. d(i)
,如何获取(i)
而不是1(d)i
(参见前面屏幕截图中黄色突出显示的字段)?
编辑:使用最近的评论进行更改。
答案1
我建议你加载枚举项包并使用其\setlist
宏重新定义 1 级至 3 级枚举环境中标签的外观。
\documentclass{amsart}
%% I've tried to simplify and streamline the preamble
\newtheorem{definition}{Definition}
\usepackage[colorlinks,allcolors=blue]{hyperref} % optional
\usepackage{enumitem} % see https://ctan.org/pkg/enumitem
\setlist[enumerate,1]{label=\upshape(\arabic*),
ref=\arabic*}
\setlist[enumerate,2]{label=\upshape(\alph*),
ref=\arabic{enumi}\alph*}
\setlist[enumerate,3]{label=\upshape(\roman*),
ref=(\roman*)}
\begin{document}
\setcounter{section}{3} % just for this example
\setcounter{definition}{5}
\begin{definition}\label{def:6}
Definition 6
\begin{enumerate}
\item djdj* \label{crit:1}
\begin{enumerate}
\item jffj
\item krlf
\item krfk
\begin{enumerate}
\item dkdk
\item krkd
\item keld
\item shsj
\item krlf
\end{enumerate}
\item skxk* \label{crit:1d}
\begin{enumerate}
\item jddj* \label{crit:1di}
\end{enumerate}
\item kssk
\end{enumerate}
\item skdk
\item krdk
\end{enumerate}
\end{definition}
\section{Labels of Criteria in the Numbered Lists in Definition \ref{def:6}}
\noindent
\ref{def:6} -- \ref{crit:1} -- \ref{crit:1d} -- \ref{crit:1di}
\end{document}