Question: I have a list:

```
\begin{enumerate}[label={[\Roman*]},ref={[\Roman*]}]

\item\label{item1} The first item.

\end{enumerate}

```

What I want to achieve is this: 

In the most instances, I want to refer to the items of the list by the format specified above (that is: `\ref{item1}` should in general produce "[I]"). However, in a few particular instances, I want to refer to the items by a custom reference formatting (more specifically, without the square brackets, by "1" instead of "[1]"), but I want still that the numbering is automatic (otherwise, I could use, for example `\hyperref[item1]{1}` to refer). Therefore, I would like to, for example, define a new command `\nobracketsref` such that `\nobracketsref{item1}` should produces "1".

How this could be achieved? I would appreciate any help.

PS. In the situation there is one twist that may affect the solution: I have two `.tex` files so that the list is in one file (the list document) and I am referring to its items from the other file (the main document). 

This is done in a usual way by involving in the preamble of the main document:

```
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument{the_list_document.tex}

```

Answer: 
Define `ref=` to use a macro, instead of the explicit brackets; such a macro can be redefined to do nothing when the brackets are not wanted.

```
\documentclass{article}
\usepackage{enumitem,xparse}
\usepackage[colorlinks]{hyperref}

\makeatletter
\NewDocumentCommand{\nobracketref}{sm}{%
  \begingroup\let\bracketref\@firstofone
  \IfBooleanTF{#1}{\ref*{#2}}{\ref{#2}}%
  \endgroup
}
\makeatother
\NewDocumentCommand{\bracketref}{m}{[#1]}

\begin{document}

\begin{enumerate}[label={[\Roman*]},ref={\bracketref{\Roman*}}]
\item\label{item1} The first item.
\end{enumerate}

With brackets: \ref{item1} (link)

With brackets: \ref*{item1} (no link)

Without brackets: \nobracketref{item1} (link)

Without brackets: \nobracketref*{item1} (no link)

\end{document}

```

I don't think `xr-hyper` is much of a concern here.

[![enter image description here](https://i.stack.imgur.com/W0rtE.png)](https://i.stack.imgur.com/W0rtE.png)
You have a couple of options:

1. Remove the brackets using a delimited argument.
2. Create a new `\label` that uses `\Roman` instead of `[\Roman]`.

The first option is implemented by means of your `\nobracketsref{<label>}` choice. The second option is implemented by means of a `\speciallabel{<what>}{<label>}`. `<what>` here is set to `\Roman{enumi}`, since `enumi` is the first-level counter within an `enumerate`.

[![enter image description here](https://i.stack.imgur.com/vg5fI.png)](https://i.stack.imgur.com/vg5fI.png)

```
\documentclass{article}

\usepackage{enumitem,hyperref,refcount}

\makeatletter
\newcommand*{\speciallabel}[2]{{%
  \protected@edef\@currentlabel{#1}% Update the current label
  \label{#2}% \label item
}}
\def\@removebrackets[#1]{#1}
\newcommand*{\nobracketsref}[1]{{%
  \edef\@nobracketsref{\getrefnumber{#1}}% Retrieve reference
  \expandafter\edef\expandafter\@nobracketsref\@nobracketsref% Strip outer group
  \expandafter\edef\expandafter\@nobracketsref\expandafter{\expandafter\@removebrackets\@nobracketsref}% Strip [.]
  \hyperref[#1]{\@nobracketsref}% Reference
}}
\makeatother

\begin{document}

\begin{enumerate}[label={[\Roman*]},ref={[\Roman*]}]
  \item\label{item1}\speciallabel{\Roman{enumi}}{item2} The first item.
\end{enumerate}

\ref{item1} \quad \nobracketsref{item1} \quad \ref{item2}

\end{document}

```