5

I have a list that looks like follows:

1 (a) Red Apple

  (b) Blue Apple

2 (a) Red Orange

  (b) Blue Orange

I want to say "(a) implies (b)." So I label items as follows:

\begin{enumerate}
\item \begin{enumerate}
\item Red Apple \label{red}
\item Blue Apple \label{blue}
\end{enumerate}
\item \begin{enumerate}
\item Red Orange
\item Blue Orange
\end{enumerate}
\end{enumerate}

When I write

\ref{red} implies \ref{blue}

it gives 1(a) implies 1(b). How can I get rid of the number 1 in front of (a) and (b)?

9

Using the enumitem package you can easy customize the reference representation using the ref key:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\ref{red} implies \ref{blue}

\begin{enumerate}
\item \begin{enumerate}[label=(\alph*),ref=(\alph*)]
\item Red Apple \label{red}
\item Blue Apple \label{blue}
\end{enumerate}
\item \begin{enumerate}
\item Red Orange
\item Blue Orange
\end{enumerate}
\end{enumerate}

\end{document}

enter image description here

By the way, with standard LaTeX you would get 1a and 1b and not 1(a) and 1(b).

A solution without packages:

\documentclass{article}

\makeatletter
\renewcommand\theenumii{(\alph{enumii})}
\renewcommand\labelenumii{(\alph{enumii})}
\renewcommand\p@enumii{}
\renewcommand\p@enumiii{\theenumi\theenumii}
\makeatother

\begin{document}

\ref{red} implies \ref{blue}

\begin{enumerate}
\item \begin{enumerate}
\item Red Apple \label{red}
\item Blue Apple \label{blue}
\end{enumerate}
\item \begin{enumerate}
\item Red Orange
\item Blue Orange
\end{enumerate}
\end{enumerate}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.