make4ht with table environment

When I have running pdflatex it's not showing error and showing error with make4ht. How to rectify this? and How to get the entities should be hexadecimal values instead of utf? (Ex: “ should be &#x201C;).

Where to get/see the documentation of make4ht-domfilter file?

My MWE is:

\documentclass{acm-book}
\usepackage{balance}
\usepackage{amsmath}
\usepackage{booktabs,hyperref,listings,xcolor,colortbl}
\usepackage[inactive]{fancytooltips}
\usepackage{wrapfig}
\usepackage{afterpage}
\usepackage{makeidx}

\begin{document}

\chapter{What is {\textquotedblleft}Software{\textquotedblright}?}

Furthermore, legacy software systems are notoriously difficult to replace. As noted experienced by this author as a chief information officer, legacy systems take considerable effort and money to replace and tend to be built upon, rather than replaced. So, those working on systems for complex organizations are likely to have to deal with these existing software systems. US Social Security Administration still dependencies on legacy software further entrenches its use. Other systems used by the US government have software sub-systems.

\begin{table}[!t]
\caption{\label{tab:4.1}\textbf{MIPS machine code instruction types}}
\arrayrulecolor{black}
\begin{tabular}{ | l | c | c | c | c | c | c |}
\hline
Instruction Type & opcode &  &  & & & \\
\hline
\multicolumn{1}{|r|}{\#bits} & 6 & 5 & 5 & 5 & 5 & 6\\
\hline
\hline
R-type & op & rs & rt & rd & shamt & funct\\
\hline
I-type & op & rs & rt & \multicolumn{3}{c|}{address/immediate}\\
\hline
J-type & op & \multicolumn{5}{l|}{target address}  \\
\hline
\end{tabular}
\end{table}

When reusing existing software, it is wise to evaluate the relevance of the techniques and assumptions that were used in building that original software. This book focuses on software as a technology and how it has evolved over time. We will look at the trends, important innovations, and events, as well as the ever-broadening world of software.

\end{document}

• Works for me with 1) the book class (I don't have acm-book) 2) \caption{MIPS machine code instruction types} \label{tab:4.1} instead of your \caption line, and 3) \arrayrulecolor{black} commented out (don't ask me why!). The UTF-8 curly quotes look fine in Firefox. Jul 3 at 15:22

This seems like a bug in TeX4ht support for the Colortbl package. It assumes that the \arrayrulecolor command is used inside tabular or other similar environment. When you use it outside, like in your case, it will break.

The fixed redefinition of the command may look like this:

\newcommand\tmp:arrayrulecolor[2][named]{%
\ifvoid\@arstrutbox% test if we are inside a tabular environment
\convertcolorspec{#1}{#2}{HTML}\:tmp\global\let\hline:color\:tmp% we are not
\else%
\noalign{\convertcolorspec{#1}{#2}{HTML}\:tmp\global\let\hline:color\:tmp}% we are
\fi
}
\HLet\arrayrulecolor\tmp:arrayrulecolor


This version of \arrayrulecolor saves the declared color in the form that is usable in CSS styling for array lines.

The \ifvoid\@arstrutbox is used to detect if we are inside tabular, when we need to wrap the color extraction in \noalign command to prevent compilation errors.

Here is a full version of colortbl.4ht:

% colortbl.4ht (2021-05-06-14:12), generated from tex4ht-4ht.tex
% Copyright 1997-2009 Eitan M. Gurari
% Copyright 2009-2021 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2021-05-06-14:12}

\RequirePackage{xcolor}
\CT@everycr{\o:noalign:{\global\let\CT@row@color\relax}\the\everycr}
\def\columncolor#1{{\def\current@color{#1}%
\csname a:cell-colortbl\endcsname}}
\Odef\columncolor[#1]#2{{\if :#1:\def\current@color{#2}%
\else
\convertcolorspec{#1}{#2}{HTML}\tmp:tblcolor
\Configure{HColor}{tblcol-\tblcol:N}{\#\tmp:tblcolor}%
\def\current@color{tblcol-\tblcol:N}%
\fi
\csname a:cell-colortbl\endcsname}%
\futurelet\:temp\left:colcol}
\def\left:colcol{%
\ifx [\:temp \expandafter\left::colcol \fi
}
\def\left::colcol[#1]{
\futurelet\:temp\right:colcol
}
\def\right:colcol{%
\ifx [\:temp \expandafter\right::colcol \fi
}
\def\right::colcol[#1]{}
\HAssign\tblcol:N = 0
\def\CT@cellc#1[#2]#3{{\if :#2:\def\current@color{#3}%
\else
\convertcolorspec{#2}{#3}{HTML}\tmp:tblcolor
\Configure{HColor}{tblcol-\tblcol:N}{\#\tmp:tblcolor}%
\def\current@color{tblcol-\tblcol:N}%
\fi
\csname a:cell-colortbl\endcsname}%
\futurelet\:temp\left:colcol}
\NewConfigure{@classz}{4}
\pend:def\@classz{\pic:gobble\a:@classz}
\append:def\@classz{\pic:gobble\b:@classz}
\pend:def\insert@column{\pic:gobble\c:@classz}
\append:def\insert@column{\pic:gobble\d:@classz}
\def\:temp{\global\let\CT@do@color\relax}
\HLet\CT@@do@color\:temp
\let\::maketitle\o:maketitle:
\def\o:maketitle:{%
\ifx \EndPicture\:UnDef
\NewConfigure{@classz}{4}%
\Configure{@classz}{}{}{}{}%
\fi
\::maketitle }
\def\rowcolor{%
\o:noalign:{\ifnum0=}\fi
\global\let\CT@do@color\CT@@do@color
\relax
\ifnum \HRow=0\relax
\expandafter\ifx\csname lt:sv\endcsname\relax
\HAssign\HRow = 1\relax
\else
\HAssign\HRow = \lt:sv \relax
\fi
\fi\fi
%
\@ifnextchar[\CT@rowa\CT@rowb}
\def\CT@rowa[#1]#2{%
\save:color#1 #2//%
\pic:gobbleII\a:rowcolor{#2}%
\gdef\CT@row@color{\CT@color{#2}}%
\CT@rowc}
\def\CT@rowb#1{%
\pic:gobbleII\a:rowcolor{#1}%
\gdef\CT@row@color{\CT@color{#1}}%
\CT@rowc}
\NewConfigure{rowcolor}{1}
% default hline color is black
\def\hline:color{000}
% save rule color in format usable in CSS
\newcommand\tmp:arrayrulecolor[2][named]{%
\ifvoid\@arstrutbox% test if we are inside a tabular environment
\convertcolorspec{#1}{#2}{HTML}\:tmp\global\let\hline:color\:tmp% we are not
\else%
\noalign{\convertcolorspec{#1}{#2}{HTML}\:tmp\global\let\hline:color\:tmp}% we are
\fi
}
\HLet\arrayrulecolor\tmp:arrayrulecolor
\def\convert:colorspec#1 #2 #3 #4{%
\edef\current:color{%
\ifx\relax#1\relax\else%
#1\ifx\relax#2\relax\else%
, #2\ifx\relax#3\relax\else%
, #3\ifx\relax#4\relax\else%
, #4%
\fi%
\fi%
\fi%
\fi%
}%
}

\def\save:color#1 #2//{%
\convert:colorspec#2 {} {} {} {}
\convertcolorspec{#1}{\current:color}{HTML}\tmp:col
\def\current@color{#2}
\Configure{HColor}{\current@color}{\#\tmp:col}
}

\def\begin:current@color{\let\sv:curcolor\current@color}
\def\end:current@color{%
\ifx \current@color\sv:curcolor
\else%
\expandafter\save:color\current@color//%
\csname a:text-colortbl\endcsname
\fi
}
\NewConfigure{text-colortbl}{1}
\def\GET@column@color{}
\def\color:ii[#1]#2#3!*?: {\def\:temp{#1 #2}}
\def\color:i#1#2!*?: {\def\:temp{#1}}
\let\ctbl:mcol\multicolumn
\def\multicolumn#1#2#3{%
\ctbl:mcol{#1}{#2}{#3}%
\expand:after{\expandafter\MUL:LMN\meaning\@preamble}\MUL:PA//%
\ignorespaces}
{
\def\MUL:PA{\gdef\MUL:PA}
\def\MUL:LMN{%
\catcode\C=12
\catcode\T=12
\catcode\@=12
\catcode\c=12
\catcode\o=12
\catcode\l=12
\catcode\r=12
\catcode\t=12
\catcode\e=12
\catcode\m=12
\catcode\p=12
\catcode\d=12
\catcode\i=12
\catcode\b=12
\gdef\MUL:LMN}
\MUL:LMN#1CT@color #2@tempdimb#3//{\::KOLOR{#2}}
\MUL:PA{CT@color @tempdimb}
}
\def\::KOLOR#1{\if :#1:\else \:KOLOR#1//%
\fi}
\def\:KOLOR{\@ifnextchar[\mc:clr{\mc:clr[]}}
{
\catcode\{=12
\catcode\}=12
\catcode$$=1 \catcode$$=2
\gdef\mc:clr[#1]{#2}((%
\def\current@color(\if :#1:\else #1 \fi #2)%
\csname a:cell-colortbl\endcsname
)\def\:temp##1//()\:temp)
)
\NewConfigure{cell-colortbl}{1}

\Hinput{colortbl}
\endinput


There is also an issue caused by use of \textbf inside \caption. Try this version of nameref.4ht:

% nameref.4ht (2022-06-27-13:57), generated from tex4ht-4ht.tex
% Copyright 2005-2009 Eitan M. Gurari
% Copyright 2009-2022 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2022-06-27-13:57}

\let\NR:Type\relax
\let\ltx@label\label
\def\prf:label{{\ifx \NR:Title\:UnDef \else \NR:Title\fi}%
{\ifx \NR:Type\relax \else \NR:Type .1\fi}{}}%
\let\NR:StartSec\:StartSec
\let\NR:no@sect\no@sect
\def\no@sect#1#2#3#4#5#6[#7]#8{\gdef\NR:Title{\a:newlabel{#7}}%
\gdef\NR:Type{#1}%
\NR:no@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}}
\def\:StartSec#1#2#3{%
\gdef\NR:Title{\a:newlabel{#3}}%
\gdef\NR:Type{#1}%
\NR:StartSec{#1}{#2}{#3}%
}

\def\:tempc#1#2#3#4#5#6[#7]#8{%
\gdef\NR:Title{\a:newlabel{#7}}%
\gdef\NR:Type{#1}%
\o:NR@sect:{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}}
\HLet\NR@sect\:tempc

\def\:tempc#1#2#3#4#5{%
\gdef\NR:Title{\a:newlabel\ssect:ttl}%
\gdef\NR:Type{#1}%
\o:NR@ssect:{#1}{#2}{#3}{#4}{#5}%
}
\HLet\NR@ssect\:tempc

\def\:tempc[#1]#2{%
\gdef\NR:Title{\a:newlabel{#1}}%
\gdef\NR:Type{part}%
\o:no@part:[{#1}]{#2}}

% this definition clashes with asmart and amsproc classes, so we
% need to skip if these are active
\@ifundefined{opt@amsart.cls}{%
\@ifundefined{opt@amsproc.cls}{%
\HLet\no@part\:tempc
}{}}{}

\def\:tempc#1{%
\gdef\NR:Title{\a:newlabel{#1}}%
\gdef\NR:Type{part}%
\o:no@spart:{#1}}
\HLet\no@spart\:tempc

\def\:tempc[#1]#2{%
\gdef\NR:Title{\a:newlabel{#1}}%
\gdef\NR:Type{chapter}%
\o:NR@chapter:[{#1}]{#2}}
\HLet\NR@chapter\:tempc

\def\:tempc#1{%
\gdef\NR:Title{\a:newlabel\sch:ttl}%
\o:NR@schapter:{#1}%
\gdef\NR:Type{chapter}%
}
\HLet\NR@schapter\:tempc

\let\o:NR@@caption\@caption
%
%
% Keith Andrews <kandrews@iicm.edu> reported that \@captype as
% \NR:Type threw an undefined control sequence error. I think
% \@currenvir is safe, there is nothing special about \@captype.
%
% use of \index and \label inside caption results in a fatal error
% we need to disable them in \NR:Title
\long\def\@caption#1[#2]{%
\gdef\NR:Type{\@currenvir}%
\begingroup%
\let\index\:gobble%
\let\label\:gobble%
\protected@xdef\NR:Title{\a:newlabel{#2}}%
\endgroup%
\o:NR@@caption{#1}[{#2}]%
}

\let\o:NRorg@opargbegintheorem\@opargbegintheorem
\def\@opargbegintheorem#1#2#3{%
\gdef\NR:Title{\a:newlabel{#3}}%
\gdef\NR:Type{\@currenvir}%
\NR@gettitle{#3}%
\defineautorefname{\@currenvir}{#1}%
\o:NRorg@opargbegintheorem{#1}{#2}{#3}%
}%

\let\o:NRorg@begintheorem\@begintheorem
\def\@begintheorem#1#2{%
\gdef\NR:Title{\a:newlabel{#1 #2}}%
\gdef\NR:Type{\@currenvir}%
\defineautorefname{\@currenvir}{#1}%
\NR@gettitle{}%
\o:NRorg@begintheorem{#1}{#2}%
}%

% I don't know if this was useful for anything
% but we cannot use it anymore
% \AtBeginDocument{%
\def\:tempc#1{%
\gdef\NR:Title{\a:newlabel{listing}}%
\gdef\NR:Type{lstlisting}%
\o:NROrg@lst@MakeCaption:{#1}%
\gdef\@currentlabelname{listing}}
\HLet\NROrg@lst@MakeCaption\:tempc
}{}%
% bug [348]
\def\:tempams{%
\gdef\NR:Title{\a:newlabel{equation}}%
\gdef\NR:Type{equation}%
\gdef\@currentlabelname{equation}%
}

% https://tex.stackexchange.com/a/581856/2891
\pend:defIII\caption@beginex{%
\gdef\NR:Type{\@currenvir}%
\gdef\NR:Title{\a:newlabel{##2}}%
}
}{}

\Configure{@begin}{align}{\:tempams}
\Configure{@begin}{multline}{\:tempams}
\Configure{@begin}{equation}{\:tempams}
\Configure{@begin}{boxed}{\:tempams}
\Configure{@begin}{equations}{\:tempams}
\Configure{@begin}{equation}{\:tempams}
\Configure{@begin}{gather*}{\:tempams}
\Configure{@begin}{gather}{\:tempams}
\Configure{@begin}{genfrac}{\:tempams}
\Configure{@begin}{measure@}{\:tempams}
\Configure{@begin}{multline*}{\:tempams}
\Configure{@begin}{multline}{\:tempams}
\Configure{@begin}{overset}{\:tempams}
\Configure{@begin}{smallmatrix}{\:tempams}
\Configure{@begin}{split}{\:tempams}
\Configure{@begin}{subarray}{\:tempams}
\Configure{@begin}{substack}{\:tempams}
\Configure{@begin}{underset}{\:tempams}
\Configure{@begin}{xleftarrow}{\:tempams}
\Configure{@begin}{xrightarrow}{\:tempams}
}{
\Configure{@begin}{equation}{\:tempams}
}

\let\T:ref=\::ref
\def\::ref{\@ifstar{\protect\T@ref}{\protect\T@ref}}
\def\T@ref#1{%
\@safe@activestrue
\let\::ref \T:ref
\expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}%
\def\::ref{\@ifstar{\protect\T@ref}{\protect\T@ref}}
\@safe@activesfalse
}

\gdef\defineautorefname#1#2{%
\expandafter\gdef\csname #1autorefname\endcsname{#2}}
\defineautorefname{theorem}{Theorem}

\Configure{newlabel}
{\csname cur:th\endcsname \csname :currentlabel\endcsname}
{\string\csname\space :autoref\string\endcsname
{\NR:Type}#1}

\ifx \@currentlabelname\:UnDef
\let\@currentlabelname\empty
\fi

\pend:defIII\@setref{\edef\RefArg{##3}}
\append:defIII\@setref{\let\:autoref\:gobble}
\let\:autoref\:gobble

\Hinput{nameref}
\endinput


And your document then looks like this:

• @michal.21: I have getting [ERROR] htlatex: ./Index.tex 862 Argument of \@caption has an extra }. [ERROR] htlatex: ./Index.tex 37 Paragraph ended before \@caption was complete. [ERROR] htlatex: ./index.aux 18 Paragraph ended before \n:wlbl was complete.. But not showing any issues when using pdflatex. It's only make4ht Jul 4 at 7:21
• @Balaji this is caused by the fix for \index inside \caption. See the updated answer for fixed nameref.4ht. Jul 4 at 11:12
• Now its working fine. But when using -f jats option xml is generating with utf characters. I have need xml is getting with unicode entities like &#x002A;. How to do this? Jul 4 at 11:28
• @Balaji why do you need this? it isn't easily possible due to the fact that LuaXML encodes most entities as Unicode characters. Jul 4 at 11:37
• I would like to convert xml to epub format using tex4ebook`. So that requirement is needed for me. Jul 4 at 11:41