[tex4ht] \autoref from hyperref with tex4ht

William F Hammond hammond at csc.albany.edu
Wed May 11 17:59:22 CEST 2011


Radhakrishnan CV <cvr at river-valley.org> writes:
> ...
>> \usepackage{hyperref}
>> ...
>> \begin{figure}
>>  \caption{My figure.}
>>  \label{fig}
>> \end{figure}
>>
>> See~\autoref{fig}.
> ...
> Attached is a newer version of nameref.4ht. In my tests, this version
> seems to fix the problem of not only \autoref, but also \nameref which
> was also broken.

A brief experiment trying to write a newcommand to work
around this

  \newcommand{\figref}[1]{\href{\##1}{figure~\ref*{#1}}}

suggests to me that \ref* -- hypperref's inert form of \ref
producing the textual representation of the reference value
without a link -- is not yet supported by tex4ht.

And there's another issue here: the author-provided label
key ("fig" in this example) is swallowed; it never appears
in the html output.  So the particular location cannot be
referenced in the standard html way as "#fig".  Instead if
the author wanted to publish a link to the specific location
the # reference would be, for my build, #x1-21, which one
can hardly imagine as durable.

I'm not necessarily suggesting that robotic keys be
suppressed because tex4ht may need them for its own
purposes.  But author keys should survive even if there will
be several keys for one location.  (There will probably
need to be some restrictions on the characters used in
survivable author keys.)

In fact, after forcing the inclusion of textcomp in faq.sty,
I've just built the TeXLive 2010 (fully updated) version of
the UKTUG FAQ with tex4ht by running htlatex on
letterfaq.tex.  But the frequently published keys to
questions are lost in the otherwise very nice html output.

                                    -- Bill





More information about the tex4ht mailing list