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

                 Summary: Problem with TOC with tex4ht when using `accent` and
`hyperref` with `\texorpdfstring`
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Fri Jul 18 17:44:56 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/748073/problem-with-toc-with-tex4ht-when-using-accent-and-hyperref-with-texorpdfs>

I found I need to use \texorpdfstring in sections titles in order to work
around a compile error with lualatex. see
<https://tex.stackexchange.com/questions/748072/why-adding-package-accents-with-hyperref-causes-tex-capacity-exceeded>
for reference

But now I find the table of content in HTML generated by tex4ht is corrupted.
Here is MWE

-------------------
\documentclass[12pt]{article}%
\usepackage{accents}
\usepackage{hyperref}
\begin{document}
\tableofcontents

%must use \texorpdfstring to workaround compile error with lualatex
\section{Deformation gradient tensor  \texorpdfstring{$\tilde{Q}$}{Q}}%
test
\end{document}
---------------------

The above compiles OK now with lualatex. But with tex4ht it gives this

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

enter image description here

The HTML source code is

<h3 class='likesectionHead' id='contents'><a id='x1-1000'></a>Contents</h3>
<div class='tableofcontents'>   
<span class='sectionToc'>1 <a href='#deformation-gradient-tensor-accent-e-q'
id='QQ2-1-2'>Deformation gradient tensor <span class='mathjax-inline'>
\(\cc@accent {"707E\relax }{Q}\)</span></a></span>
    </div>   

    <h3 class='sectionHead' id='deformation-gradient-tensor-accent-e-q'>
<span class='titlemark'>1   </span> <a id='x1-20001'></a>Deformation gradient
tensor <span class='mathjax-inline'>\(\tilde {Q}\)</span></h3>

<!-- l. 12 --><p class='noindent'>test
</p> 

Why does this happen and how to correct it?

TL 2025 on Linux.

Thanks
--Nasser




    _______________________________________________________

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

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

Reply via email to