[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

Michal Hoftich puszcza-hackers at gnu.org.ua
Thu Aug 17 10:42:08 CEST 2023


Follow-up Comment #1, bug #607 (project tex4ht):

You can try something like this:

%%%%%%%%%%%%%%%%%%%
\Preamble{xhtml}
\let\origlabel\label
\def\label#1{%
\HCode{<span id="#1">}%
\origlabel{#1}%
\HCode{</span>}%
}
\begin{document}
\EndPreamble
%%%%%%%%%%%%%%%%%%%

It will add <span id="label name"> elements at the point of \label. 

In addition, if you use make4ht instead of htlatex, it sets every section to
use id based on the section name. So your sample produces something like
this:

<h3 class='sectionHead' id='exporting-in-various-formats'><span
class='titlemark'>1   </span> <a id='x1-10001'></a>Exporting in various
formats</h3>

You can then link to "#exporting-in-various-formats" which should be stable
unless you change the section title.



    _______________________________________________________

Reply to this item at:

  <http://puszcza.gnu.org.ua/bugs/?607>

_______________________________________________
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



More information about the tex4ht mailing list.