4

I want to create hyperlinks to the items of a etaremune or revnum environment. It works with the enumerate environment, but how can I do the same with a list with reverse numbering? Here is an example in which only the hyperlinks to the enumerate environment work.

\documentclass[a4paper,10pt]{article}
\usepackage{etaremune}                      
\usepackage{revnum}
\usepackage{hyperref}

\begin{document}
 \begin{enumerate}
   \item aaa \label{1} 
   \item bbb \label{2}
 \end{enumerate}

 \begin{etaremune}[start=4]
   \item ccc \label{4}
   \item ddd \label{3}
 \end{etaremune}

 \begin{revnumerate}[6]
   \item eee \label{6}  
   \item fff \label{5}
 \end{revnumerate}

 \ref{1}, \ref{2}, \ref{3}, \ref{4}, \ref{5}, \ref{6}
\end{document}

In the correspondig pdf, the \ref{3} and \ref{4} do not link to the line 3. ddd and 4. ccc as they should but to the last item of the enumerate environment, that is the line 2. bbb.

  • just to be sure: when I say that the hyperlinks to the items in the etaremune do not works, means that, in the pdf, the \ref{3} and \ref{4} do not link to the line 3. ddd and 4. ccc as they should but to the last item of the enumerate environment, that is the line 2. bbb. Do you see a different behavior? – user47026 Feb 28 '14 at 0:38
  • Ah, now I see the problem. Please add this information to your question, so everyone can quicly see what the problem is. I'll delete my previous command shortly. – Gonzalo Medina Feb 28 '14 at 0:40
1

Here is an approach which appears to work (and allows nested enumerate).

etaremune with hyperref 1

etaremune with hyperref 2

\documentclass[a4paper,10pt]{article}
\usepackage{etaremune}                      
\usepackage[colorlinks]{hyperref}

\providecommand*{\phantomsection}{}% for compatibility if hyperref not loaded
\newcommand{\lebal}{\phantomsection\label}

\begin{document}

 \begin{etaremune}[start=4]
   \item \lebal{A} ccc 
   \item \lebal{B} ddd
   \item \lebal{C} and
     \begin{etaremune}
       \item \lebal{C.top} eee
       \item \lebal{C.middle} fff
       \item \lebal{C.bottom} ggg
     \end{etaremune}
 \end{etaremune}

 \ref{A}, \ref{B}, \ref{C} and \ref{C.top}, \ref{C.middle}, \ref{C.bottom}
\end{document}
0

I have found a workaround: the hyperlinks with reverse numbering work when using the newenvironment (originally posted by mhelvens in Is there a way to get reverse numbering on the enumerate environment?):

\newenvironment{benumerate}[1]{
  \let\oldItem\item
  \def\item{\addtocounter{enumi}{-2}\oldItem}
  \begin{enumerate}
   \setcounter{enumi}{#1}
   \addtocounter{enumi}{1}
}{
  \end{enumerate}
}

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.