![子列表中项目的格式引用](https://linux22.com/image/346438/%E5%AD%90%E5%88%97%E8%A1%A8%E4%B8%AD%E9%A1%B9%E7%9B%AE%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%BC%95%E7%94%A8.png)
我将该enumitem
包用于我的列表。为了方便起见,我只显示当前列表的项目,但我希望引用显示所有必要的结构,以免将我引用的项目与具有相同子列表引用的另一个项目混淆。以下是代码:
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{label={\bfseries\arabic*.}}
\setlist[enumerate,2]{label={\bfseries\alph*)}}
\begin{document}
\begin{enumerate}
\item first big item
\begin{enumerate}
\item first little item of the first big item
\item second little item of the first big item\label{second-little-of-first-big}
\end{enumerate}
\item second big item
\begin{enumerate}
\item first little item of the second big item
\item second little item of the second big item\label{second-little-of-second-big}
\end{enumerate}
\end{enumerate}
I like this display (because it's light), but when I want
to refer to the first reference or to the second, it is
displayed by \ref{second-little-of-first-big} and
\ref{second-little-of-second-big}, and I would like it to be
refered by \textbf{1.b)} and\textbf{ 2.b)}.
\end{document}
这使得:
我知道我可以放一些类似的内容
\renewcommand{\labelenumii}{\theenumi.\theenumii.}
,但我不想在列表中显示所有重叠列表的数字,我只希望在参考文献中显示它。
答案1
本质上,您可以像格式化标签一样格式化参考:
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{label={\bfseries\arabic*.}}
\setlist[enumerate,2]{label={\bfseries\alph*)},ref={\bfseries\theenumi\alph*)}}
\begin{document}
\begin{enumerate}
\item first big item
\begin{enumerate}
\item first little item of the first big item
\item second little item of the first big item\label{second-little-of-first-big}
\end{enumerate}
\item second big item
\begin{enumerate}
\item first little item of the second big item
\item second little item of the second big item\label{second-little-of-second-big}
\end{enumerate}
\end{enumerate}
I like this display (because it's light), but when I want
to refer to the first reference or to the second, it is
displayed by \ref{second-little-of-first-big} and
\ref{second-little-of-second-big}, and I would like it to be
referred by \textbf{1.b)} and \textbf{2.b)}.
\end{document}