[Tex/LaTex] How to cross-reference custom labels in the enumitem lists without having the punctuation show up

#enumeratecross-referencingenumitemlists

I am using enumitem to handle my enumerate and itemize lists. I have a list like

\begin{enumerate}[label=Step \arabic{enumi}.]
\item step the first \label{en:step-1}
\item el secundo \label{en:step-2}
\item item the third \label{en:step-3}
\end{enumerate}

When I cross-reference one of these items, the punctuation shows up in the document. For example,

Let us reference \ref{en:step-1}.

gives me

Let us reference Step1..

The regular enumerate or itemize environments don't have this problem; punctuation does not show up when cross-referencing.

In the enumitem documentation there is an option afterlabel but that is only for inline lists.

Is there an option in enumitem, or a way of using enumitem that adds the correct punctuation to the list, but lets me cross-reference the label without the punctuation?

Best Answer

Use the ref key:

\begin{enumerate}[label=Step \arabic{enumi}.,ref=Step \arabic{enumi}]
\item step the first \label{en:step-1}
\item el secundo \label{en:step-2}
\item item the third \label{en:step-3}
\end{enumerate}

A complete example:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=Step \arabic{enumi}.,ref=Step \arabic{enumi}]
\item step the first \label{en:step-1}
\item el secundo \label{en:step-2}
\item item the third \label{en:step-3}
\end{enumerate}
Let us reference \ref{en:step-1}.

\end{document}

enter image description here

Related Question