How do I put a prime superscript on ii in (ii)? MWE:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=(\roman*)]
\item\label{A} First
\item\label{B} Second
\item\label{C} Want to have (ii') here.
\item\label{D} Fourth
\end{enumerate}
Let's reference them: \ref{A}, \ref{B}, \ref{C} (want to have (ii') also here), and \ref{D}.
\end{document}
As opposed to that, I want to have
(i) First
(ii) Second
(ii') Another version of (ii).
(iii) Fourth
Let's reference them: (i), (ii), (ii'), (iii).
How to do that in latex without introducing global changes to standard macros? We are still allowed to introduce our own, fresh macros and local changes to standard macros. Moreover, I'd still like to reference all the items with \ref{A}
, \ref{B}
, \ref{C}
, \ref{D}
, not with (\ref{A})
, (\ref{B})
, (\ref{C})
, (\ref{D})
.
The suggestion Referencing a custom labeled item in enumitem inline list doesn't put a prime into the parentheses (at least, I don't know how to do it). Dropping the parentheses globally as in How do I put subscripts on referenced items with enumitem? would require me to introduce parentheses manually into references to many list items in all the remaining 100+ pages of a book; it's not something I'd like to have. (The comments to the accepted answer there are confusing, btw.) The only portion of latex code I would like to change is really the list in question and its surroundings, and, perhaps, the preamble.
Addendum: when using cleveref in addition, see the question for enumitem and cleveref.