URL:
  <https://puszcza.gnu.org.ua/bugs/?662>

                 Summary: Problem using hyperref with label in tex4ht. It
displays label different than pdf
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Sun Jul 27 08:44:06 2025
                Category: None
                Priority: 5 - Normal
                Severity: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Reference and screen shots at 

<https://tex.stackexchange.com/questions/748709/problem-using-hyperref-with-label-in-tex4ht-it-displays-label-different-than-pd>

Did something change in tex4ht? I am using TL 2025, installed fresh one week
ago on new Linux.

When doing \hyperref[1]{1} then later \subsection{Problem 1}\label{1} , I
expected the link to point and also display 1. That what happens in the PDF.

But in tex4ht, the link points correctly to the subsection when clicking on
it, but it does not display what the label is which is1.

Instead is displays 1.1.1 which seems to be tex4ht internal titlemark it
generates.

I want it the link to display 1 as that is the label.

Am I doing something wrong? How to make it display 1? Do I need to use
something other than \label with tex4ht? I do not remember this is how it used
to be, else I would have noticed it.

Here is MWE
----------------------------

\documentclass[12pt]{book}
\usepackage{hyperref}
\usepackage{longtable}
\begin{document} 

\chapter{my table}
\section{Chapter 1. First order differential equations. Section 1.2. Problems
at page 17}
\begin{longtable}{|p{0.4in}|p{0.6in}|p{5in}|}\hline
\hyperref[1]{1}&1&$y^{\prime} = 2 x +1$\\ \hline
\hyperref[2]{2}&2&$y^{\prime} = \left(x -2\right)^{2}$\\ \hline
\end{longtable}

\subsection{Problem 1}\label{1}

text

\subsection{Problem 2}
\label{2}

text
\end{document}
-------------------------

Compiled with lualatex, gives correct display and link in the pdf

enter image description here

But compiled with tex4ht it gives

make4ht  -ulm default -a debug index.tex "mathjax,htm" 

enter image description here

Notice the label is not 1 but 1.1.1. Here is raw HTML generated

----------------------
<h2 class='chapterHead' id='my-table'><span class='titlemark'>Chapter
1</span><br /><a id='x1-10001'></a>my table</h2>
   
<h3 class='sectionHead'
id='chapter-first-order-differential-equations-section-problems-at-page-'><span
class='titlemark'>1.1   </span> <a id='x1-20001.1'></a>Chapter 1. First order
differential equations. Section 1.2. Problems at
page 17</h3>
<!-- l. 8 --><p class='noindent'>
<a id='x1-2001r1'></a></p>   <!-- l. 9 --><div class='longtable'> <table
class='longtable' id='TBL-1'><colgroup id='TBL-1-1g'><col id='TBL-1-1'
/></colgroup><colgroup id='TBL-1-2g'><col id='TBL-1-2' /></colgroup><colgroup
id='TBL-1-3g'><col id='TBL-1-3' /></colgroup>
<tr class='hline'><td></td><td></td><td></td></tr><tr id='TBL-1-1-'
style='vertical-align:baseline;'><td class='td11' id='TBL-1-1-1'
style='white-space:normal; text-align:left;'>
<!-- l. 9 --><p class='noindent'><a href='#problem-'>1.1.1<!-- tex4ht:ref: 1 
--></a> </p></td><td class='td11' id='TBL-1-1-2' style='white-space:normal;
text-align:left;'>
<!-- l. 9 --><p class='noindent'>1          </p></td><td class='td11'
id='TBL-1-1-3' style='white-space:normal; text-align:left;'>
<!-- l. 9 --><p class='noindent'><span class='mathjax-inline'>\(y^{\prime } =
2 x +1\)</span>                                                          
</p></td>
</tr><tr class='hline'><td></td><td></td><td></td></tr><tr id='TBL-1-2-'
style='vertical-align:baseline;'><td class='td11' id='TBL-1-2-1'
style='white-space:normal; text-align:left;'>
<!-- l. 10 --><p class='noindent'><a href='#problem-1'>1.1.2<!-- tex4ht:ref: 2
 --></a> </p></td>
<td class='td11' id='TBL-1-2-2' style='white-space:normal; text-align:left;'>
<!-- l. 10 --><p class='noindent'>2          </p></td>
<td class='td11' id='TBL-1-2-3' style='white-space:normal; text-align:left;'>
<!-- l. 10 --><p class='noindent'><span class='mathjax-inline'>\(y^{\prime } =
\left (x -2\right )^{2}\)</span>                                              
            </p></td>
</tr><tr class='hline'><td></td><td></td><td></td></tr>
</table></div>   

<h4 class='subsectionHead' id='problem-'><span class='titlemark'>1.1.1  
</span> <a id='x1-30001.1.1'></a>Problem 1</h4>
<!-- l. 16 --><p class='noindent'>text

</p>   
<h4 class='subsectionHead' id='problem-1'><span class='titlemark'>1.1.2  
</span> <a id='x1-40001.1.2'></a>Problem 2</h4>
<!-- l. 21 --><p class='noindent'>text
</p>   
-------------------

The HTML above shows tex4ht is generating different titlemarks than what the
\label is.

>which make4ht
/usr/local/texlive/2025/bin/x86_64-linux/make4ht
>make4ht --version
make4ht version v0.4d

Thanks
--Nasser




    _______________________________________________________

Reply to this item at: <https://puszcza.gnu.org.ua/bugs/?662>

_______________________________________________
Message sent via/by Puszcza <https://puszcza.gnu.org.ua/>

Reply via email to