子列表中项目的格式引用

子列表中项目的格式引用

我将该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}

在此处输入图片描述

相关内容