TransWikia.com

Translating a description environment style into a reference-able enumerate environment

TeX - LaTeX Asked on July 7, 2021

In the description environment, I like the [style=newline] provided by the enumitem package. Is there a way I can use a similar style in an enumerate environment, so that I can label the items using label and refer to their numbers using, for example, cref from the cleveref package?

Below is a MWE using a description environment, but to be clear, I would like to modify it so that it is an enumerate environment that I can refer to by number.

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}

mwe

One Answer

Here's another approach that creates a bespoke enumerate-like environment.

enter image description here

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}

setlengthparindent{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}

Answered by Mico on July 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP