4

I found a problem in math generated after updated to latest TL. All math in chapter and/or section titles is messed up now. This used to show up OK before I updated to TL. I've used this for years before with no problem.

The math which is not in section or chapter title still shows OK.

Here is a MWE

\documentclass[12pt]{book}%
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}

\frontmatter
\title{my book title}
\author{me}
\date{\today}
\maketitle

\ifdefined\HCode 
\Configure{tableofcontents*}{chapter}   
\TocAt{chapter,section}
\TocAt{section,subsection}
\TocAt{subsection,subsubsection}
\TocAt{subsubsection,paragraph}
\fi 

\tableofcontents
\mainmatter

\chapter{First order ode $F\left(  x,y,y^{\prime}\right)  =0$}%

The equation is  $F\left(  x,y,y^{\prime}\right)  =0$

\section{First order linear in derivative $F\left(  x,y,y^{\prime}\right)=0$}%
These are first order ode's which are linear in $y^{\prime}$.
\subsection{Quadrature ode $y^{\prime}=f\left(  x\right)  $}
data
\subsubsection{Introduction}
data
\end{document}

Compiled using

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

This is the HTML

enter image description here

Notice all those \o stuff. Before updated TL this all worked OK and the math showed up OK in section and chapter titles. So something changed.

This is the raw HTML

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title>my book title</title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='index.css' rel='stylesheet' type='text/css' /> 
<meta content='index.tex' name='src' /> 
<script>window.MathJax = { tex: { tags: "ams", }, }; </script> 
 <script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js' type='text/javascript'></script>  
</head><body>
<!-- l. 10 --><p class='indent'>
</p>   
<div class='maketitle'>
<h2 class='titleHead'>my book title</h2>
<div class='author'><span class='ec-lmr-12x-x-120'>me</span></div><br />
<div class='date'><span class='ec-lmr-12x-x-120'>December 26, 2022</span></div>
</div>
<h2 class='likechapterHead' id='contents'><a id='x1-1000'></a>Contents</h2>
<div class='tableofcontents'>   
<span class='chapterToc'>1 <a href='#first-order-ode-fleft-xyy-right-' id='QQ2-1-2'>First order ode \(F\o:left: ( x,y,y^{\prime }\o:right: ) =0\)</a></span>
</div>
<!-- l. 27 --><p class='indent'>
</p>   
<h2 class='chapterHead' id='first-order-ode-fleft-xyy-right-'><span class='titlemark'>Chapter 1</span><br /><a id='x1-20001'></a>First order ode \(F\left ( x,y,y^{\prime }\right ) =0\)</h2>
<div class='chapterTOCS'>   
 <span class='sectionToc'>1.1 <a href='#first-order-linear-in-derivative-fleft-xyy-right-' id='QQ2-1-3'>First order linear in derivative \(F\o:left: ( x,y,y^{\prime }\o:right: )=0\)</a></span>
</div>
<!-- l. 29 --><p class='indent'>   The equation is \(F\left ( x,y,y^{\prime }\right ) =0\)
</p>   
<h3 class='sectionHead' id='first-order-linear-in-derivative-fleft-xyy-right-'><span class='titlemark'>1.1   </span> <a id='x1-30001.1'></a>First order linear in derivative \(F\left ( x,y,y^{\prime }\right )=0\)</h3>
<div class='sectionTOCS'>   
  <span class='subsectionToc'>1.1.1 <a href='#quadrature-ode-y-fleft-xright-' id='QQ2-1-4'>Quadrature ode \(y^{\prime }=f\o:left: ( x\o:right: ) \)</a></span>
</div>
<!-- l. 32 --><p class='indent'>   These are first order ode’s which are linear in \(y^{\prime }\).
</p>   
<h4 class='subsectionHead' id='quadrature-ode-y-fleft-xright-'><span class='titlemark'>1.1.1   </span> <a id='x1-40001.1.1'></a>Quadrature ode \(y^{\prime }=f\left ( x\right ) \)</h4>
<div class='subsectionTOCS'>   
   <span class='subsubsectionToc'><a href='#introduction' id='QQ2-1-5'>Introduction</a></span>
</div>
<!-- l. 34 --><p class='indent'>   data
</p>   
<h5 class='subsubsectionHead' id='introduction'><a id='x1-5000'></a>Introduction</h5>
<div class='subsubsectionTOCS'>   
</div>
<!-- l. 36 --><p class='indent'>   data
</p>   
 
</body> 
</html>

Using

>which tex4ht
/usr/local/texlive/2022/bin/x86_64-linux/tex4ht
>make4ht --version
make4ht version v0.3l

Ticket at https://puszcza.gnu.org.ua/bugs/index.php?589

1 Answer 1

6

When you encounter issues with math commands in TOC with the MathJax mode, you usually need to declare the problematic command using the \fixmathjaxtoc command. In this case, the issue is with \left and \right, so you can declare them using:

\Preamble{xhtml}
\fixmathjaxtoc\left
\fixmathjaxtoc\right
\begin{document}
\EndPreamble

This is the result:

enter image description here

5
  • 1
    Thanks Michal. That fixed it. But I am really confused. Why was it working OK before I updated TL last night? I have been doing this for long time without these commands you showed and this is the first time I saw these funny characters show up in table of content. Any way, thanks for the fix.
    – Nasser
    Commented Dec 27, 2022 at 20:27
  • @Nasser I am not sure. When was the last time you updated your distro? I've changed \left and \right to be robust commands in August, but I don't think this change should cause this issue.
    – michal.h21
    Commented Dec 27, 2022 at 20:37
  • Last time I've updated TL (other than last night) was long time ago. May be before august. I do not update TL much as I am afraid something will break when I do :)
    – Nasser
    Commented Dec 27, 2022 at 20:40
  • @Nasser at least I got lot of bug reports when you do the update. Anyway, it is possible that it was some other change, it could be change in LaTeX core as well.
    – michal.h21
    Commented Dec 27, 2022 at 20:46
  • No problem. Complicated software so anything can happen. Thanks again for the fix.
    – Nasser
    Commented Dec 27, 2022 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .