4

I’m currently preparing a paper for submission to the journal ‘Automatica.’ I initially typeset the paper using the ‘elsarticle.cls’. However, after submission, the corresponding editor emailed me and suggested that to re-typeset the paper using ‘autart.cls.’ Here’s my problem: It seems that \hyperref is not working! For instance, when I want to cite an equation using \eqref{}, the hyperlink won’t be active (it just shows the number of the equation). This problem also persists when referring to a figure or theorem. Any help will be greatly appreciated. Thank you all. In the following, I add the packages that I'm using.

\documentclass[twocolumn]{autart}

\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{float}
\usepackage[sort]{natbib}
\usepackage[colorlinks=true,allcolors=MidnightBlue]{hyperref}
\bibliographystyle{agsm}

\setlength{\parindent}{12pt}

\begin{document}

\begin{frontmatter}

\title{Test\thanksref{footnoteinfo}}

\thanks[footnoteinfo]{This paper was not presented at any IFAC meeting.}

\end{frontmatter}

\section{Sec}

\begin{align} \label{Eq1}
  F = m.a\textrm{.}
\end{align}

Consider the equation \eqref{Eq1}.

\end{document} 
2
  • Could you add a full Minimal Working Example recreating your problem all the way to \end{document}? When I write a short document with that class and those packages, it seems like \eqref is working perfectly well.
    – Elad Den
    Oct 4, 2020 at 5:27
  • You are absolutely right. As you proposed, I wrote a short document, and \eqref worked perfectly. But when I added the \frontmatter environment, I encountered the same problem. As you asked, I will add a full Minimal Working Example. Oct 4, 2020 at 5:49

1 Answer 1

4

The class makes a bad error: its \frontmatter command issues \NoHyper instead of enclosing the whole thing in \begin{NoHyper}...\end{NoHyper}, so the adjustments made by \endNoHyper are lost.

Since \endNoHyper (which is executed when \end{NoHyper} is processed) does

% hyperref.sty, line 6451:
\def\endNoHyper{%
  \global\let\hyper@link\hyper@livelink
}

it is clear why links no longer work.

It's not wrong to use \NoHyper in the code for \frontmatter, so long as \endNoHyper is used somewhere, quite likely in \endfrontmatter.

The simplest method to fix the issue is to add \endNoHyper at the end of \endfrontmatter.

\documentclass[twocolumn]{autart}

% fix the missing \paperheight setting
\setlength{\paperheight}{297mm}
%%%

\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{float}
\usepackage[sort]{natbib}
\usepackage[colorlinks=true,allcolors=MidnightBlue]{hyperref}

%%% fix the missing bit in \endfrontmatter
\edef\endfrontmatter{%
  \unexpanded\expandafter{\endfrontmatter}% the current code
  \noexpand\endNoHyper % add \endNoHyper at the end to match \NoHyper
}
%%%

\bibliographystyle{agsm}

%\setlength{\parindent}{12pt} % you shouldn't change the class default

\begin{document}

\begin{frontmatter}

\title{Test\thanksref{footnoteinfo}}

\thanks[footnoteinfo]{This paper was not presented at any IFAC meeting.}

\end{frontmatter}

\section{Sec}

\begin{align} \label{Eq1}
  F = m.a\textrm{.}
\end{align}

Consider the equation \eqref{Eq1}.

\end{document} 

I also added the setting to \paperheight that's needed by hyperref.

enter image description here

1
  • 1
    It worked! I can't thank you enough. Oct 4, 2020 at 8:53

You must log in to answer this question.

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