0

I am writing a LaTex document using the jmlr2e.sty package.

In the main text I want to refer to the Appendix using links. On the pdf when I click on the links they redirect me to the current section instead of redirecting me to the appendix.

Here is a MWE

\documentclass[twoside,11pt]{article}
\usepackage{jmlr2e}
\begin{document}
\title{MWE}
\editor{John}
\maketitle

\section{Introduction}
     See Appendix~\ref{app:appendix} for more details.
\newpage

\appendix

\section{The Details}
\label{app:appendix}
     Here are more details

\end{document}

When I click on A on the pdf document I am redirected to the section Introduction instead of the Appendix.

I am quite lost in the jmlr2e.sty file that I am not supposed to modify. Here is what I read on the appendix:

\renewcommand{\appendix}{\par
  \setcounter{section}{0}
  \setcounter{subsection}{0}
  \def\thesection{\Alph{section}}
\def\section{\@ifnextchar*{\@startsiction{section}{1}{\z@}{-0.24in}{0.10in}%
         {\large\bf\raggedright}}%
 {\@startsiction{section}{1}{\z@}{-0.24in}{0.10in}
         {\large\bf\raggedright Appendix\ }}}}

1 Answer 1

0

The solution is to add the following line before the \appendix instruction.

\renewcommand{\theHsection}{A\arabic{section}}
5
  • 1
    Add it to the preamble instead. Littering these commands throughout your article gives it a bad structure. You seem to be able to get away with just \renewcommand\theHsection{\thesection}. The issue is the hyperref anchor nit being unique as it takes the number value of the section counter, and thus there are now two labelled 1
    – daleif
    Sep 17, 2019 at 10:39
  • Thank you for the explanation of the matter. However putting this line in the preamble does not work...
    – fonfonx
    Sep 17, 2019 at 10:43
  • It did for me on your MWE
    – daleif
    Sep 17, 2019 at 10:46
  • Hmm that's strange, it does not work on the MWE for me...
    – fonfonx
    Sep 17, 2019 at 10:51
  • 1
    You should of course not be using \renewcommand{\theHsection}{A\arabic{section}} but something similar to \renewcommand\theHsection{\thesection}, adding your version to the preamble does not make it unique.
    – daleif
    Sep 17, 2019 at 10:58

You must log in to answer this question.

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