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.


%use one or the other of these



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}

\caption{\label{fig:label} This is a figure, with a label.}

\Xref{fig:label} has a picture in it, as was described in
\Xref{sec:intro} \cite{De-Valois:1991jt,Ramachandran:1990aa}.


  • 1
    your sample is missing bibliography, so i cannot test natbib, but \hyperref's \autoref` is working with tex4ht if you want to try it instead of hevea
    – michal.h21
    Jul 30, 2014 at 8:53
  • There's a complete sample in this gist: gist.github.com/crowding/fc9fac3daa89f6c544b2 I'll see about trying tex4ht.
    – crowding
    Jul 30, 2014 at 19:07

1 Answer 1


I've found some small problems with your document, it is compilable both with pdflatex and tex4ht after small fixes:

%use one or the other of these

\autoref seem to work better with tex4ht


add this to the preamble, this enables direct inclusion of png and jpg images with tex4ht.


you want author-year bibliography, but you used plain style, which is numeric. replace it with plainnat.

The result after compilation with

htlatex sample.tex

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.