# The format of references to enumitem's enumeration lists items

I have a list of axioms, and I am using enumitem to label them:

\documentclass{article}
\usepackage{enumitem}
\newcommand\fmt[1]{$\mathbf{(#1)}$}
\begin{document}

\begin{enumerate}[format=\fmt]

\item[Ex_1]\label{ax1} The sky is blue.

\item[Egreg_\infty]\label{ax2} Another item.

\end{enumerate}
The first condition is \ref{ax1}
\end{document}


All the \items have their optional parameter, because the names do not follow a simple pattern. I'd like the \ref to be formatted in exactly the same way as the label appears in the list. But it seems that when \item is given its optional argument it does not even emit a anchor for a reference, let alone format the reference like the label.

Is there a way to do this?

• That's pretty normal, I'd say. Can you expand the example code so that the different patterns can be seen? – egreg Mar 23 '15 at 21:55
• Isn't this the same problem as: enumitem - labels fine - but references defined empty – Alan Munn Mar 23 '15 at 22:02
• @egreg, well, that's easy: just copy the \item I wrote and replace Ex_1 by Unit :-) The items are axioms for things, and their names are short appreviations (sometimes with decorations, like Ex_3') – Mariano Suárez-Álvarez Mar 23 '15 at 22:14
• @AlanMunn, modulo the fact that egreg's solution there has the \refs be the counter values, not the actual labels. – Mariano Suárez-Álvarez Mar 23 '15 at 22:16

Use a different mark up.

\documentclass{article}
\usepackage{enumitem}

\DeclareRobustCommand\fmt[1]{$\mathbf{(#1)}$}
\newenvironment{axioms}
{\enumerate[format=\fmt]}
{\endenumerate}
\makeatletter
\newcommand{\axiom}[1]{%
\def\@currentlabel{\fmt{#1}}\item[#1]%
}
\makeatother

\begin{document}

\begin{axioms}

\axiom{Ex_1}\label{ax1} The sky is blue.

\axiom{Egreg_\infty}\label{ax2} Another item.

\end{axioms}

The first condition is \ref{ax1}, while the second is \ref{ax2}.

\end{document}


• One can probably redefine \item in the before of list to avoid using a different markup, I guess. – Mariano Suárez-Álvarez Mar 23 '15 at 23:17
• @MarianoSuárez-Alvarez Sure, but why? Good markup is rewarding in the long run. – egreg Mar 23 '15 at 23:19