htlatex 与文章和回忆录

htlatex 与文章和回忆录

为什么以下文档(带有文章文档类):

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

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

创建一个完美的 html 文档。

而以下(使用回忆录)会产生错误:

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

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

以下是错误

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

注意:两者都能生成完全完美的 pdf。

答案1

我认为问题在于,memoir和都tex4ht重新定义了很多标准宏。tex4ht努力将LaTeX表格转换为对应的html宏。为了做到这一点,它在标准宏中插入了一些可配置的钩子。但似乎memoir也改变了标准表宏,在某种程度上与tex4ht

tex4ht这个问题可以通过编写配置文件来解决memoir。事实上,它是存在的,但它非常基础,并且不包含表的配置。你可以看看它在 ctan 上

因此,目前需要的是了解内部结构和处理表memoir的方式的人为表和可能的其他东西编写配置,从而重新定义。tex4htmemoirmemoir


编辑

首先,您可以尝试自动包含 memoir 加载的包的配置。将此文件放在memoir.4ht您的文档的目录中:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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}                         %
%                                                        %
%                             [email protected]  %
%                 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{%
   \gHAdvance\:mpNum by 1
\HAssign\minipageNum=\:mpNum \relax
%
   {\SkipRefstepAnchor \let\addcontentsline\:gobbleIII\no@chapter[#1]{}%
    \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

相关内容