AASJournals / AASTeX60

Version 6 of the LaTeX style files and documentation for authoring AAS Journal (AJ/ApJ) articles.
https://journals.aas.org/aastex-package-for-manuscript-preparation/
LaTeX Project Public License v1.3c
46 stars 26 forks source link

navigation window for pdfs #72

Closed parkus closed 5 years ago

parkus commented 6 years ago

It is a nice feature to have an article's sections show up in the navigation pane of PDF viewers. Supposedly this can be achieved by simply adding \usepackage{hyperref} to the end of the preamble (https://tex.stackexchange.com/questions/42343), but it doesn't seem to work with AASTeX. Not essential, but it would be awesome if it did work, especially for really long articles! I suspect AASTeX might redefine the section commands in a way that breaks hyperref. Even better than having to use hyperref would be if AASTeX automatically generated what is needed for the navigation pane.

Below is an MWE. If the document class is changed from aastex62 to article, then the generated PDF will show the section headings in a navigation pane. (Make sure to delete the intermediate files before regenerating a PDF.)

\documentclass{aastex62}
\usepackage{hyperref}

\begin{document}

\section{Intro}
``The man in black fled across the desert, and the gunslinger followed.'' So begins Stephen King's \textit{Dark Tower} series.

\section{Body}
The series is quite long. 

\section{Conclusions}
I recommend listening to the series as an audiobook on cross-country drives. 

\end{document}
augustfly commented 6 years ago

hi,

Yes, it is true that the ToC is disabled, but perhaps not why you think.

We directly import hyperref into aastex6+ and as detailed in the documentation direct users to use \hypersetup to modify the hyperlinking functionality as needed. Re-importing hyperref is unnecessary.

However, it appears that a) we disable hyperref bookmarks (and thus disable the ToC) by default in aastex62 (see aastex62.cls#L1997) and more critically b) unlike other hyperref variables, this cannot be undone via hypersetup.

In the MWE example below, you can see that the user can change the URL color, but if you watch the compile logs LaTeX complains that,

Package hyperref Warning: Option `bookmarks' has already been used, (hyperref) setting the option has no effect on input line 10.

While the user cannot change the bookmarks default setting from false to true they can override the urlcolor from blue to green. I'll have to dig to see why this is the case, but the issue for me is much bigger than author customization.

We have learned that a working table of contents is a critical step for creating PDFs that are accessible to those with disabilities. I am lost as to why we issue bookmarks=False, as a default, though I am clearly the person to blame as I created that default block. Since this is most undesirable default behavior, I am marking this issue as a bug to be rectified in a future release. For now, modifying your individual aastex62 file to undo the bookmarks=false should get you much closer to where you want to be for a working ToC in your manuscripts.

Mind the defaults even those set secretly by well-meaning AASTeX editors.

\documentclass{aastex62}

\hypersetup{
    bookmarks=True,
    urlcolor=green
}

\begin{document}

\section{Intro}
``The man in black fled across the desert, and the gunslinger followed.'' So begins Stephen King's \textit{Dark Tower} series.

\section{Body}
The series is quite long. See section \ref{sec:c}. \url{http://google.com}

\section{Conclusions}
I recommend listening to the series as an audiobook on cross-country drives. 

\end{document}
parkus commented 6 years ago

Ah interesting. And even more interesting to know that this is actually an accessibility issue. Changing to bookmarks=true in the aastex62.cls file did the trick for me! Thank you for digging that out!