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

Conflict with cleveref package #69

Open syrte opened 6 years ago

syrte commented 6 years ago

AASTeX62 seems conflicting with the cleveref package. The \cref command works well with figure, table and equation labels but does not work with section label. Here is an example,

\documentclass[twocolumn]{aastex62}
% \documentclass{article}
\usepackage{cleveref}
\begin{document}
\section{Section1} \label{sec1}
\subsection{subsection1} \label{subsec1}
\begin{equation}
y=ax+b \label{eqn}
\end{equation}
Sec \ref{sec1}, \cref{sec1}\\
Sec \ref{subsec1}, \cref{subsec1}\\
Eqn \ref{eqn}, \cref{eqn}
\end{document}

image

It outputs warnings like

LaTeX Warning: cref reference format for label type `' undefined on input line 7.

So it failed to identify the type of the label for sections.

augustfly commented 6 years ago

Thank you for this report, especially with the MWE. I don't see anything in your MWE that gives me a clue as to a work around. The best response I can give is that we will queue this bug for review.

To advance the discussion, what functionality does cleveref provide that is being inhibited by its current incompatibility with aastex?

syrte commented 6 years ago

I've checked the document of cleveref, it mentioned a known bug, it may relate to this issue.

image

However the code below seems good

% \documentclass[twocolumn]{aastex62}
\documentclass{article}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{cleveref}
\begin{document}
\section{Section1} \label{sec1}
\subsection{subsection1} \label{subsec1}
\begin{equation}
y=ax+b \label{eqn}
\end{equation}
Sec \ref{sec1}, \cref{sec1}\\
Sec \ref{subsec1}, \cref{subsec1}\\
Eqn \ref{eqn}, \cref{eqn}
\end{document}

image

augustfly commented 5 years ago

It is not clear, but this did not get fixed in v6.3 (or at least not intentionally). Retagging for v6.4

gregschwarz commented 5 years ago

That is right, we only focused on the siunitx.sty conflict in this round.

bugchan commented 4 years ago

The solution listed in the comment of this thread solve the problem for me when using aastex62.cls.

https://tex.stackexchange.com/questions/171796/cref-does-not-work-for-section-in-emulateapj-cls/239694

\documentclass[twocolumn]{aastex62}
\usepackage{cleveref}

\makeatletter
\usepackage{etoolbox}
\patchcmd\H@refstepcounter{\protected@edef}{\protected@xdef}{}{}
\makeatother