# htlatex with article vs memoir

Why does the following document (with article document class):

\documentclass{article}
\begin{document}
\begin{tabular}{c|c}
\hline
1 & 2 \\
\hline

\hline
5 & 6 \\
\hline
\end{tabular}
\end{document}


creates a perfect html doc.

While the following (using memoir) produces the error:

\documentclass{memoir}
\begin{document}
\begin{tabular}{c|c}
\hline
1 & 2 \\
\hline

\hline
5 & 6 \\
\hline
\end{tabular}
\end{document}


Following is the error

l.3 --- TeX4ht warning --- \halign translated into linear text ---
! Missing number, treated as zero.
<to be read again>
\ar:cnt
l.4 \hline


Note: Both produce completely perfect pdfs.

-

I think the problem is that both memoir and tex4ht redefines lot of standard macros. tex4ht tries hard to translate LaTeX tables to their html counterparts. In order to do that, it inserts some configurable hooks to standard macros. But it seems that memoir also changes standard table macros, in some way which is incompatible with tex4ht

This problem can be solved by writing tex4ht configuration file for memoir. In fact, it exists, but it is really basic and it doesn't contain configuration for tables. You can see it on the ctan

So what is needed at the moment is that someone who understands memoir internals and the way in which tex4ht handles tables write configurations for memoir's tables and possibly other things, which memoir redefines.

Edit

For start, you can try to include configurations for packages loaded by memoir automatically. Place this file as memoir.4ht in directory with your document:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% memoir.4ht                           2009-05-21-09:32 %
% Copyright (C) 2003--2009      Eitan M. Gurari         %
%                                                        %
% 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".%
%                                                        %
% This Current Maintainer of this work                   %
% is Eitan M. Gurari.                                    %
%                                                        %
% If you modify this program your changing its signature %
% with a directive of the following form will be         %
% appreciated.                                           %
%            \message{signature}                         %
%                                                        %
%                             gurari@cse.ohio-state.edu  %
%                 http://www.cse.ohio-state.edu/~gurari  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version 2009-05-21-09:32}

\input book.4ht
\input verse.4ht
% Tables Handling
\input array.4ht
\input dcolumn.4ht
\input tabularx.4ht
\input booktabs.4ht
\let\rm\empty
\let\sf\empty
\let\tt\empty
\let\bf\empty
\let\it\empty

\def\@chapter[#1]#2{%
\HAssign\minipageNum=\:mpNum \relax
%
\global\let\f@rtoc\f@rtoc
\global\let\f@rhdr\f@rhdr  }%
\HtmlEnv   \Toc:Title{#1}\:chapter{#2}}
\NewConfigure{poemline}{2}

\ifx \memgobble\:UnDef
\pend:defI\getthelinenumber{%
\let\sv:thepoemline\thepoemline
\pend:def\thepoemline{\a:poemline}%
\append:def\thepoemline{\b:poemline}}
\append:defI\getthelinenumber{\let\thepoemline\sv:thepoemline}

\else
\pend:defII\getthelinenumber{%
\let\sv:thepoemline\thepoemline
\pend:def\thepoemline{\a:poemline}%
\append:def\thepoemline{\b:poemline}}
\append:defII\getthelinenumber{\let\thepoemline\sv:thepoemline}

\fi
\Hinput{memoir}
\endinput

-
yes i understood that much however i would like to know what to put in the memoir.4ht so that it doesn't cripple my html.. is there someway to inherit tabular from article instead of memoir? Any solution if i have a 1000 page document written using memoir commands and don't have the flexibility to change to article? what would be the easiest way around? –  RamneekHanda Dec 5 '12 at 7:57
@RamneekHanda I added sample config file –  michal.h21 Dec 5 '12 at 9:12
thanks for the solution. could you help me with the tex.stackexchange.com/questions/85302/… , after making your recommended changes there in that example it fails somewhere else :( –  RamneekHanda Dec 5 '12 at 11:21
+1 I really appreciate how much you know about tex4ht, thanks so much :) –  cmhughes Dec 6 '12 at 1:51
ahh cant delete comments.. had put it on wrong post :) –  RamneekHanda Dec 6 '12 at 9:28