I have an existing document that was written using hyperref and natbib, and am trying to generate a website alongside the PDF that is already built. The document was written using autoref references and natbib author-year citations.
I am using hevea to generate the HTML version, and am having problems with cross-references.
If I use hyperref, hevea encounters these errors, and inline citations and references appear as ??:
./text.aux:14: Giving up command: \addtokens
./text.aux:4: Giving up command: \AtBeginDocument
./text.aux:4: Giving up command: \HyperFirstAtBeginDocument
./text.tex:15: Giving up command: \input
./text.tex:15: Giving up command: \@readaux
./text.tex:15: Warning: Failure while reading .aux, reading .haux
(note that if I use hevea -fix
or bibhva
to make an .haux
, natbib fails in other ways, so I'd like to stick with the .aux
file.)
If I use cleveref and not hyperref, the citaions work, but cross references still have ?? where words like "Figure", "Section," etc. ought to be generated.
In either case the PDF compiles fine.
I stripped down my document to something minimal, included below, with a Makefile, bibliography and other assets in this Gist.
\documentclass[english]{article}
\usepackage{hevea}
\usepackage{graphicx}
\usepackage[english]{babel}
%use one or the other of these
%\usepackage{hyperref}
%\newcommand{\Xref}[1]{\autoref{#1}}
\usepackage{cleveref}
\newcommand{\Xref}[1]{\Cref{#1}}
\usepackage[authoryear]{natbib}
\usepackage{trouble}
\begin{document}
\section{Introduction}\label{sec:intro}
This document has citations \cite{Ilg:2010vn}, using authoryear style
(\cite{Wertheimer:1912aa}, \cite{Wertheimer:2012aa};
\cite{Steinman:2000ap}). It should also have figure graphics and
internal references using cleveref or hyperref, such as the imminent reference
to \Xref{sec:graphics}.
\section{Section 2}\label{sec:graphics}
\begin{figure}
\includegraphics[height=2in,width=5in]{demo_carenv}
\caption{\label{fig:label} This is a figure, with a label.}
\end{figure}
\Xref{fig:label} has a picture in it, as was described in
\Xref{sec:intro} \cite{De-Valois:1991jt,Ramachandran:1990aa}.
\bibliographystyle{plain}
\bibliography{bib}
\end{document}
natbib
, but \hyperref's
\autoref` is working withtex4ht
if you want to try it instead ofhevea