TransWikia.com

Hyperref does not work in autart.cls

TeX - LaTeX Asked by sajad pourali on December 23, 2020

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{Testthanksref{footnoteinfo}}

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

end{frontmatter}

section{Sec}

begin{align} label{Eq1}
  F = m.atextrm{.}
end{align}

Consider the equation eqref{Eq1}.

end{document} 

One Answer

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:
defendNoHyper{%
  globallethyper@linkhyper@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
edefendfrontmatter{%
  unexpandedexpandafter{endfrontmatter}% the current code
  noexpandendNoHyper % 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{Testthanksref{footnoteinfo}}

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

end{frontmatter}

section{Sec}

begin{align} label{Eq1}
  F = m.atextrm{.}
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

Answered by egreg on December 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP