# Make4ht with % in the Caption

The below LaTeX file is working fine with pdflatex and showing error in make4ht. How to recetify this? When I have used % in the figure captions it's writing in the aux file and show error.

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

\lipsum[3]

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.

\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. The purpose of GDPR is to protect personal data at large.

\end{document}


UPDATE 2:

\ref and \index also showing error when using make4ht. Please see updated the question in the \caption.

• Which version of tex4ht do you use? When I try your example I don't get errors and the output looks ok (i.e., the caption is rendered as "Excerpt 95% from ..."). (command: make4ht -u myfile.tex, the -u is to render non-breaking spaces produced by ~ properly and is unrelated to \%). My version is make4ht version v0.3d and tex4ht itself is tex4ht.c (2018-07-03-10:36 kpathsea), from TeX Live 2019. Aug 3 at 14:43
• Also, if you get an error, what is the exact error message? Aug 3 at 14:47
• @Marijn: I have using Make4HT Version is v0.3l and TeX4HT Version is tex4ht.c (2018-07-03-10:36 kpathsea) and used Windows OS. I have updated Error Screenshot in the Question. Aug 4 at 6:02
• @Marijn: If you are check with myfile.aux file it will show 95% from a instead of 95\% from a. Aug 4 at 6:07
• Your output shows an error on line 862. The code you have given in this question does not have 862 lines. Therefore the error is most probably in a part of the code that you didn't provide. Please test with the exact code as you have given here. Aug 4 at 7:03

This issue seems to be caused by the definition of the \% command in TeX4ht sources. You can revert it to the original definition, which seems to work using the following config file:

\Preamble{xhtml}
\chardef\%=\%
\begin{document}
\EndPreamble


This is the result:

• It's showing Section~\ref{sec:1} and \index also error when using Make4HT and not showing error in pdflatex. ERROR IS : ! File ended while scanning use of \n:wlbl.`. How to rectify this also? Aug 5 at 5:19
• @Balaji I cannot reproduce this problem, can you update your question? Aug 5 at 8:10
• I have updated the question. Aug 5 at 9:00
• I have posted new question <tex.stackexchange.com/questions/653084/…> Aug 5 at 12:14