在标题中使用 \ref 和 \index 制作 4ht

在标题中使用 \ref 和 \index 制作 4ht

下面的文件编译正常,pdflatex但显示错误make4ht。如何纠正这个问题?

\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}

更新1:

在此处输入图片描述

更新2:

Figure 1.1问卷应该是Figure <a href='#fig1.1'>1.1</a>问卷。意思是caption cross-links缺失。

答案1

似乎 TeX4ht 中没有针对figure*环境的配置,因此在这种情况下您无法获得正确的 HTML 标签。我已在 TeX4ht 源代码中修复了此问题。在此更改应用于 TeX Live 之前,您可以使用以下配置文件:

\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

这是您的图形的最终 HTML 代码:

   <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>

相关内容