Make4ht with \ref and \index in the Caption

make4httex4ht

The below file compile fine with pdflatex and showing error in make4ht. How to rectify this?

\documentclass{book}
\usepackage{lipsum,hyperref}
\begin{document}
\chapter{Chapter Title}

\section{Introduction}\label{sec:1}

Nominal data are usually used with count and frequencies, such as to find out the total number of left-handed participants in a study. Figure~\hyperref[fig-001]{1.1} illustrates an excerpt from a questionnaire that collected nominal data.

\subsection{Background}\label{subsec:1-1}

\lipsum[3]

\begin{figure*}
\caption{Excerpt 95\% from a questionnaire used in an actual user study of Section~\ref{sec:1} and Subsection~\ref{subsec:1-1} to collect nominal \index{demographics} data [\protect\hyperlink{ch2-ref48}{Shang et\,\,al. 2020}].\label{fig-001}}
\end{figure*}

With this approach, the lowest, the middle, and the highest points of the actual scale are anchored to the lowest, the middle, and the highest points of the target scale, respectively, then the intervening scale points are inserted at equal numerical intervals.

The European Union-wide framework known as the General Data Protection Regulation \footnote{{\href{https://ec.europa.eu/commission/priorities/justice-and-fundamental-rights/data-protection/2018-reform-eu-data-protection-rules_en}{https://ec.europa.eu/commission/priorities/justice-and-fundamental-rights/data-protection/2018-reform-eu-data-protection-rules{\_}en}.}} EU approach data privacy.

\end{document}

UPDATE1:

enter image description here

UPDATE2:

FigureĀ 1.1 questionnaire should be Figure <a href='#fig1.1'>1.1</a> questionnaire. It means caption cross-links are missing.

Best Answer

It seems that there was no configuration for the figure* environment in TeX4ht, so you don't get correct HTML tags in this case. I've fixed this issue in TeX4ht sources. Until this change comes to TeX Live, you can use the following configuration file:

\Preamble{xhtml}
\ConfigureEnv{figure*}
{\IgnorePar\EndP\HCode{<figure class="figure">\Hnewline}%
    \bgroup \Configure{float}{\ShowPar}{}{}%
   }
   {\egroup
   \IgnorePar\EndP\HCode{</figure>}\ShowPar
\par}
   {}{}

\begin{document}
\EndPreamble

This is the resulting HTML code for your figure:

   <figure class='figure' id='-excerpt-from-a-questionnaire-used-in-an-actual-user-study-of-section-ref-sec-and-subsection-ref-subsec-to-collect-nominal-data-chrefshang-etal-'>                                                                 
<a id='x1-30011'></a>                                                         
<figcaption class='caption'><span class='id'>Figure 1.1: </span><span class='content'>Excerpt 95% from a questionnaire used in an actual user study of
Section 1.1  and Subsection 1.1.1  to collect nominal  data [<a href='#ch2-ref48'>Shang et al. 2020</a>].</span></figcaption><!-- tex4ht:label?: x1-30011  -->                                                           
   </figure>
Related Question