# Referencing a custom labeled item in enumitem inline list

I'd like to have a list where most items use the standard labels but one or two have custom labels. I'd like to be able to reference each item and have its label show up. I use enumitem, and this all works for non-inline lists:

\documentclass{article}

\usepackage[inline]{enumitem}
\makeatletter
\newcommand{\myitem}[1][]{
\protected@edef\@currentlabel{#1}%
\item[#1]
}
\makeatother

\begin{document}

\begin{enumerate}
\item \label{1} Item one
\myitem[A] \label{A} Item A
\item \label{3} Item three
\end{enumerate}

\ref{1} \ref{A} \ref{3}

\end{document}


produces the output

1. Item one
A Item A
2. Item three
1 A 2


which is exactly what I want. However, what I'd really like to do is have this in an inline list, and if I change enumerate to enumerate*, \ref{A} prints 1 instead of A.

I am guessing that somehow the inline lists don't use \@currentlabel or use it differently, but I am at a loss for what to do.

Inline lists are boxes, and so your definition is lost. Either use mode=unboxed or move the \@currentlabel definition so that it is nearer at the label:

\documentclass{article}

\usepackage[inline]{enumitem}
\makeatletter
\newcommand{\myitem}[1][]{%
\item[#1]\protected@edef\@currentlabel{#1}\ignorespaces%
}
\makeatother

\begin{document}

\begin{enumerate*}%[mode=unboxed] %would work too
\item \label{1} Item one
\myitem[A] \label{A} Item A
\item \label{3} Item three
\end{enumerate*}

\ref{1} \ref{A} \ref{3}

\end{document}