1

I have the following file

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}


\begin{tabular}{ >{\columncolor[rgb]{0,.6,1}} cc}
  Blue&White\\
  Blue&White
\end{tabular}
\bigskip

\begin{tabular}{cc}
  \rowcolor[rgb]{0,.6,1} Blue&Blue\\
  White&White
\end{tabular}

\end{document}

It compiles fine with pdflatex, but when I run htlatex on it, I get the error

(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))     (./try.aux)
! Argument of \:temp has an extra }.
<inserted text> 
                \par 
l.9   B
       lue&White\\
 ?

I am guessing, the less than sign causes the problem, but how can I get around it?

I add that Michal's answer does fix the problem with \columncolor but I get the same error if I replace it by \color. So If I have

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}


\begin{tabular}{ >{\color[rgb]{0,.6,1}} cc}
  Blue&White\\
 Blue&White
\end{tabular}

\end{document}

Then I get the error (I copy the error starting one line before the loading of the new colortbl.4ht

(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./colortbl.4ht (/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/article.4ht
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/dvips.4ht
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/dvipsnam.4ht
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texlive/texmf-dist/tex/generic/tex4ht/html4-math.4ht)) (./try.aux)
! Argument of \HColor:rgb has an extra }.
<inserted text> 
                \par 
l.7   Blue&
           White\\
? 

I add that tex4ht seems to ignore a color definition (giving no error message). Perhaps this is a separate bug? Here is a minimal example

\documentclass{article}
\usepackage{color}
\definecolor{Blue}{rgb}{0,.6,1}
\begin{document}
\color{Blue} Blue---I don't think so.
\end{document}
1

This is a bug in tex4ht colortbl support, it expects the \columncolor specification argument to be separated by spaces instead of commas. We will fix that soon, meanwhile, you can try to save the following file as colortbl.4ht:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% colortbl.4ht                          2016-12-13-20:09 %
% Copyright (C) 1997-2009       Eitan M. Gurari         %
% Copyright 2009-2016 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   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.

   \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
                           \gHAdvance\tblcol:N by 1
                           \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
\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
\ifx\LT@head\Un:Def\else
   \ifnum \HRow=0\relax
      \expandafter\ifx\csname lt:sv\endcsname\relax
        \HAssign\HRow = 1\relax
        \ifvoid\LT@head
           \ifvoid\LT@firsthead \else \HAdvance\HRow by 1\relax\fi
        \else \HAdvance\HRow by 1\relax\fi
      \else
        \HAssign\HRow = \lt:sv \relax
        \HAdvance\HRow by 1\relax
      \fi
\fi\fi
%
  \@ifnextchar[\CT@rowa\CT@rowb}
\def\CT@rowa[#1]#2{%
  \pic:gobbleII\a:rowcolor{#1 #2}%
  \gdef\CT@row@color{\CT@color[#1]{#2}}%
  \CT@rowc}
\def\CT@rowb#1{%
  \pic:gobbleII\a:rowcolor{#1}%
  \gdef\CT@row@color{\CT@color{#1}}%
  \CT@rowc}
\NewConfigure{rowcolor}{1}
\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\extract: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{%
   \typeout{current color: \current@color a \sv:curcolor}
   \ifx \current@color\sv:curcolor
   \else 
     \expandafter\extract: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

With slightly expanded example, to test also the other color spaces:

\documentclass{article}
% \usepackage[table]{xcolor}
\usepackage{colortbl}
\begin{document}


\begin{tabular}{ >{\columncolor[rgb]{0,.6,1}} cc}
  Blue&White\\
  Blue&White
\end{tabular}
\begin{tabular}{ >{\columncolor[cmyk]{0,.6,1,.4}} cc}
  Blue&White\\
  Blue&White
\end{tabular}
\begin{tabular}{ >{\columncolor[gray]{.6}} cc}
  Blue&White\\
  Blue&White
\end{tabular}
\bigskip

\begin{tabular}{cc}
  \rowcolor[rgb]{0,.6,1} Blue&Blue\\
  White&White
\end{tabular}

\end{document}

You will got the following result:

enter image description here

Your second example produces the following output:

enter image description here

  • Thanks! The original example now works. But when I specify just color for a column, it doesn't. I'll edit the original post to show what I mean, and the error. The point is that if I replace \columncolor by \color I get the same error. – Máté Wierdl Dec 13 '16 at 17:23
  • I also remark that if a define a color with \definecolor, tex4ht ignores this definition. I edit the post to reflect this observation. Let me know if I should note this as a separate bug. – Máté Wierdl Dec 13 '16 at 19:03
  • @user29363 I think that it is different issue and it would be better to ask it in another question – michal.h21 Dec 13 '16 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.