2

I have an enumerated list with the labels in parentheses. I want to reuse a label using \ref but with a prime symbol or a subscript. How do I do this?

\documentclass{article}
\usepackage{enumitem}

\setlist[enumerate,1]{label={(\arabic*)}}  

\begin{document}

\begin{enumerate}
\item This is the first sentence.
\item\label{toprime} I will give a variant of this sentence soon.
\end{enumerate}

Now here's some intervening material.

\begin{enumerate}[resume]
\item Let's stick another sentence in.
\item[\ref{toprime}$'$] I am now giving a variant of the original
  sentence.
\item[\ref{toprime}$_2$] I would also like to tack on subscripts.
\end{enumerate}
\end{document}

This gives:

enter image description here

I want the prime symbol and the subscript to appear inside the parentheses. How do I do that?

1 Answer 1

2

You can use ref to set a reference format distinct from label:

\documentclass{article}
\usepackage{enumitem}

\setlist[enumerate,1]{label={(\arabic*)},ref=\arabic*}

\begin{document}

\begin{enumerate}
\item This is the first sentence.
\item\label{toprime} I will give a variant of this sentence soon.
\end{enumerate}

Now here's some intervening material.

\begin{enumerate}[resume]
\item Let's stick another sentence in.
\item[(\ref{toprime}$'$)] I am now giving a variant of the original
  sentence.
\item[(\ref{toprime}$_2$)] I would also like to tack on subscripts.
\end{enumerate}
\end{document}

fancy variations

5
  • Thank you. That helps. But what do I do if for the rest of the paper I want my references to appear in parentheses without having to do (\ref{toprime})?
    – Ruby
    Nov 8, 2015 at 4:29
  • Sorry, I should have tried this right away. The \setlist command can occur outside of the preamble, and be changed temporarily within a given enumerate environment. So my preceding comment can be ignored.
    – Ruby
    Nov 10, 2015 at 3:46
  • @Ruby Oh, yes. Sorry. I forgot about your earlier comment. (I couldn't reply when I read it initially and I wasn't sure quite what you wanted.) I'm glad you sorted it. Yes, you can use \setlist and \newlist within the document. And you can change the format of a list multiple times, if necessary. Though it might make for confusing code.
    – cfr
    Nov 10, 2015 at 3:54
  • I was actually thinking of suggesting something like fancyref or cleverref which can format references depending on context and content. But probably not worth it unless you have a use for them anyway.
    – cfr
    Nov 10, 2015 at 3:56
  • Actually, I spoke too soon. What I said worked didn't actually work.
    – Ruby
    Nov 10, 2015 at 4:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .