将描述环境样式转换为可引用的枚举环境

将描述环境样式转换为可引用的枚举环境

在环境中description,我喜欢[style=newline]enumitem包。有没有办法让我在enumerate环境中使用类似的样式,以便我可以使用来标记项目\label并使用它们的编号来引用它们,例如\crefcleveref包裹?

下面是使用环境的 MWE description,但为了清楚起见,我想修改它,使它成为一个enumerate我可以通过数字引用的环境。

\documentclass[oneside,11pt]{book}

\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
\usepackage[capitalize]{cleveref}
\usepackage{enumitem}
\usepackage{lipsum}

\begin{document}

My list:
\begin{description}
  \item[Limitation 1.\quad Our model neglects A.] \lipsum[1]\label{itm:list:something}
  \item[Limitation 2.\quad Our model neglects B.] \lipsum[2]\label{itm:list:somethingelse}
  \item[Limitation 3.\quad Our model neglects C.] \lipsum[3]\label{itm:list:anotherthing}
\end{description}

I would like to use cleveref to refer to the limitations like, ``Recall from Limitation~\cref{itm:list:something} that...''

I would like it to print, ``Recall from Limitation~(1) that...''

\end{document}

姆韦

答案1

这是创建定制枚举类环境的另一种方法。

在此处输入图片描述

\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[expansion=true , tracking=smallcaps, letterspace=40]{microtype}
\usepackage{lipsum}

%% create a bespoke enumerate-like list env. called 'limenum' 
\usepackage{enumitem}
\newlist{limenum}{enumerate}{1}
\setlist[limenum,1]{label=\bfseries Limitation \arabic*., ref=(\arabic*), 
                    left=0pt, itemindent=4em }

%% tell cleveref how to label objects associated with counter 'limenumi'
\usepackage[capitalize]{cleveref}
\crefname{limenumi}{limitation}{limitations}

\setlength\parindent{0pt} % just for this example
\begin{document}

My list:
\begin{limenum}
  \item \textbf{Our model neglects A.} \label{itm:list:something}
        \lipsum[1][1-4]
  \item \textbf{Our model neglects B.} \label{itm:list:somethingelse}
        \lipsum[2][1-3]
  \item \textbf{Our model neglects C.} \label{itm:list:anotherthing}
        \lipsum[3][1-4]
\end{limenum}

With \verb+ \ref+: Recall from Limitations~\ref{itm:list:something} and \ref{itm:list:anotherthing} that \dots

With \verb+\cref+: Recall from \Cref{itm:list:something,itm:list:anotherthing} that \dots

\end{document}

相关内容