2

I found two big problems so far after I just updated to latest TL 2022 2 hrs ago.

So I will post two separate questions on these. If I find more, will add separate questions.

I found that table of content no longer shows up on the webpage when using split level. The index.htm has basically an empty body.

If I do not use split level, then it does show. But this is not how it is supposed to be.

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$}%
data
\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,4'

This is the HTML generated

enter image description here

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>
</body> 
</html>

You can see, empty body. This happens when asking for a split level. changing 4 to 3 or 2 in the command

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

makes no difference. Main page is empty. So something went badly wrong somewhere.

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

Ticket https://puszcza.gnu.org.ua/bugs/?588

Update

Found the problem!!

Changed

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

\tableofcontents

TO

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

Basically, one should not issue \tableofcontents in tex4ht mode.

Now the table of content shows up using the command

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

Raw HTML now shows toc

</p>   
<div class='tableofcontents'>
<span class='chapterToc'>1 <a href='foch1.htm#first-order-ode-fleft-xyy-right-' id='QQ2-2-1'>First order ode \(F\o:left: ( x,y,y^{\prime }\o:right: ) =0\)</a></span>
</div> 
</body> 
</html>

It was the issuing of \tableofcontents in tex4ht which made it not show toc!

Btw, this could be related to this change? table of content problem in tex4ht. missing numbering at level subsubsection and alignment is not correct

I also had to fix \NewConfigure{tableofcontetns*}, because it would print the TOC twice otherwise.

I do not know. But for now, I am OK and will just make sure not to use \tableofcontents in tex4ht mode.

1
  • 2
    I suspect that this will be related to the recent change to \Configure{tableofcontents*}, but I will take a look at this issue later.
    – michal.h21
    Dec 27, 2022 at 21:42

1 Answer 1

1

The issue here is that when you use \tableofcontents in document broken into several files, the TOC itself will be saved to a separate file, because it the TOC title is printed as a section. This can be fixed when you remove the TOC title, for example using this config file:

\Preamble{xhtml}
\begin{document}
\let\contentsname\empty
\EndPreamble

This is the result:

enter image description here

2
  • Ok, thanks. Do you see an issue of using my workaround instead? i.e. just avoid using \tableofcontents in tex4ht mode and use \Configure{tableofcontents*} instead as I showed? This way I do not have to make changes, or do you think your solution will be better for some other reasons?
    – Nasser
    Dec 28, 2022 at 18:55
  • @Nasser your workaround is fine too
    – michal.h21
    Dec 28, 2022 at 19:41

You must log in to answer this question.

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