帮助格式化嵌套枚举的 ref{}

帮助格式化嵌套枚举的 ref{}

在下面的 MWE 中,对列表嵌套项的引用用2. (ii)但我想表示2. (b) (ii)

你能帮我修复我的代码吗?

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\setlist[enumerate, 1]
{1., 
leftmargin  = 2em,
itemindent  = 0pt,
labelwidth  = 2em,
labelsep    = 0pt,
font        = \bfseries,
align       = left,
itemsep     = 1.5mm,
ref         = \mbox{\textup{\textbf{\arabic*.}}}}

\setlist[enumerate, 2]
{(a),
itemindent = 0pt,
labelwidth = 1.3em,
labelsep = 4pt,
align = left,
itemsep = 0.5mm,
ref=\mbox{\textup{\textbf{\theenumi{}}\hspace{1pt}(\alph*)}}}

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\textup{\textbf{\theenumi{}}\hspace{1pt}(\roman*)}}}


\begin{document}

\begin{enumerate}
\item test

\item test
\begin{enumerate}
\item tast

\item tast
\begin{enumerate}
\item tost
\item \label{my_label}My label is here.
\item tost
\end{enumerate}

\item tast
\end{enumerate}

\item test
\end{enumerate}

In \ref{my_label}, we saw.

\end{document}

在此处输入图片描述

编辑

我尝试用以下代码替换最后一段代码

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\textup{\textbf{\theenumii{}}\hspace{1pt}(\roman*)}}}

在此处输入图片描述

结果更好但是(b)字体是粗体。

是否可以将其设置为正常字体?从我对 文档的阅读来看enumitem,这似乎是不可能的。

答案1

在下面的例子中,我也尝试简化其他ref选项。

在此处输入图片描述

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\setlist[enumerate, 1]
{1., 
leftmargin  = 2em,
itemindent  = 0pt,
labelwidth  = 2em,
labelsep    = 0pt,
font        = \bfseries,
align       = left,
itemsep     = 1.5mm,
ref         = \mbox{\textbf{\arabic*.}}}

\setlist[enumerate, 2]
{(a),
itemindent = 0pt,
labelwidth = 1.3em,
labelsep = 4pt,
align = left,
itemsep = 0.5mm,
ref=\mbox{\theenumi{}\hspace{1pt}(\alph*)}}

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\theenumii\hspace{1pt}(\roman*)}}


\begin{document}

\begin{enumerate}
\item test \label{first-level}

\item test
\begin{enumerate}
\item tast \label{second-level}

\item tast
\begin{enumerate}
\item tost
\item \label{third-level}My label is here.
\item tost
\end{enumerate}

\item tast
\end{enumerate}

\item test
\end{enumerate}

In \ref{first-level}, we saw.

In \ref{second-level}, we saw.

In \ref{third-level}, we saw.



\end{document}

相关内容