Enumitem with hyperref's \nameref, in complex environments

by Coby Viner   Last Updated October 09, 2019 23:23 PM - source

I am trying to get \nameref to work properly with enumitem. To do so, I am using the preamble code provided in the existing answer on this topic.

I am then wrapping the document code from that answer, within a custom command, as shown below (and partly adapted from another answer):


I want to make use of the description environment, with the optional arguments of an enumerate environment, as follows:

\begin{description}[label={($\text{A}_{\arabic*}$)}, series=name, resume=name]
    \labelleditem{Broken} XXX
    \item XXX

This does not work, presumably in part due to the description environment not fully-implementing or making accessible the enumitem optional arguments.

How might I be able to get this to work, similar to the existing answer on this topic, but with my additional specifications, shown above?

Alternatively, how can I get \nameref to work via a more general or direct patch to enumitem?




\newcommand\[email protected]@hook[1]{}
\def\[email protected]@i#1#2#3#4{%
    \[email protected]
    \[email protected]{}%
      {\let\[email protected]\[email protected]
       \labelwidth\[email protected]
       \[email protected]@left
       \[email protected]@standard
       \[email protected]{#2}{#1}{#4}%
       \[email protected]
       \let\[email protected]\makelabel
         \[email protected]{##1}%
         \labelsep\[email protected]
         \[email protected]
           \[email protected]{\[email protected]{\[email protected]{\[email protected]@hook{##1}}}}%
           \[email protected]{\[email protected]{\[email protected]@hook{##1}}}%
           \aftergroup\[email protected]
       \[email protected]
       \[email protected]%
     \[email protected]


\AtBeginDocument{\let\descriptionlabel\[email protected]}
\renewcommand\[email protected]@hook[1]{\[email protected]{#1}#1}

% -------------------------------------


  \item [{Test}\label{Test}] Some text

\begin{description}[label={($\text{A}_{\arabic*}$)}, series=name, resume=name]
    \labelleditem{Broken} XXX
    \item XXX




The above produces:

Compiled output of the above MWE

It also outputs the following error:

Missing control sequence inserted.
<inserted text> 
l.57 ...}_{\arabic*}$)}, series=name, resume=name]

I also provide this MWE on Overleaf.

Related Questions

hyperref and nameref: Order of Package Loading

Updated March 01, 2017 17:23 PM

Simultaneously get all forms of name reference

Updated August 30, 2017 12:23 PM

References to a label

Updated January 23, 2018 12:23 PM

Capitalization variants of nameref

Updated August 09, 2018 23:23 PM

Use \nameref to get text from a custom envronment

Updated August 30, 2019 14:23 PM