Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to convert a set of tex file to html. The attached code generates perfect pdf. While it gives the following error with htlatex.

I have not much knowledge of tex so please help by being more verbose as possible.

error:

l.259 --- TeX4ht warning --- \halign translated into linear text --- 
! Missing number, treated as zero. 
<to be read again>
                     \ar:cnt  
l.259 ...rigraph.sequences}{Trigraph}{Replacement}    

related files can be seen at https://github.com/ramneek-handa/draft/source

Here is the minimal example:

\documentclass[ebook,10pt,oneside,openany,final]{memoir}

\usepackage[american]
           {babel}        % needed for iso dates
\usepackage[iso,american]
           {isodate}      % use iso format for dates
\usepackage[final]
           {listings}     % code listings


\setcounter{totalnumber}{10}

% Base definitions for tables
\newenvironment{TableBase}
{
 \renewcommand{\tcode}[1]{{\CodeStylex{##1}}}
 \newcommand{\topline}{\hline}
 \newcommand{\capsep}{\hline\hline}
 \newcommand{\rowsep}{\hline}
 \newcommand{\bottomline}{\hline}

%% vertical alignment
 \newcommand{\rb}[1]{\raisebox{1.5ex}[0pt]{##1}}    % move argument up half a row

%% header helpers
 \newcommand{\hdstyle}[1]{\textbf{##1}}             % set header style
 \newcommand{\Head}[3]{\multicolumn{##1}{##2}{\hdstyle{##3}}}   % add title spanning multiple columns
 \newcommand{\lhdrx}[2]{\Head{##1}{|c}{##2}}        % set header for left column spanning #1 columns
 \newcommand{\chdrx}[2]{\Head{##1}{c}{##2}}         % set header for center column spanning #1 columns
 \newcommand{\rhdrx}[2]{\Head{##1}{c|}{##2}}        % set header for right column spanning #1 columns
 \newcommand{\ohdrx}[2]{\Head{##1}{|c|}{##2}}       % set header for only column spanning #1 columns
 \newcommand{\lhdr}[1]{\lhdrx{1}{##1}}              % set header for single left column
 \newcommand{\chdr}[1]{\chdrx{1}{##1}}              % set header for single center column
 \newcommand{\rhdr}[1]{\rhdrx{1}{##1}}              % set header for single right column
 \newcommand{\ohdr}[1]{\ohdrx{1}{##1}}
 \newcommand{\br}{\hfill\break}                     % force newline within table entry

%% column styles
 \newcolumntype{x}[1]{>{\raggedright\let\\=\tabularnewline}p{##1}}  % word-wrapped ragged-right
                                                                    % column, width specified by #1
 % \newcolumntype{m}[1]{>{\CodeStyle}l{##1}}              % variable width column, all entries in CodeStyle
 \newcolumntype{m}[1]{l{##1}}                           % variable width column, all entries in CodeStyle
}
{
}

% General Usage: TITLE is the title of the table, XREF is the
% cross-reference for the table. LAYOUT is a sequence of column
% type specifiers (e.g. cp{1.0}c), without '|' for the left edge
% or right edge.

% usage: \begin{floattablebase}{TITLE}{XREF}{COLUMNS}{PLACEMENT}
% produces floating table, location determined within limits
% by LaTeX.
\newenvironment{floattablebase}[4]
{
 \begin{TableBase}
 \begin{table}[#4]
 \caption{\label{#2}#1}
 \begin{center}
 \begin{tabular}{|#3|}
}
{
 \bottomline
 \end{tabular}
 \end{center}
 \end{table}
 \end{TableBase}
}

% usage: \begin{floattable}{TITLE}{XREF}{COLUMNS}
% produces floating table, location determined within limits
% by LaTeX.
\newenvironment{floattable}[3]
{
 \begin{floattablebase}{#1}{#2}{#3}{htbp}
}
{
 \end{floattablebase}
}


\newcommand{\CodeStylex}[1]{\texttt{#1}}
\newcommand{\tcode}[1]{\CodeStylex{#1}}

\begin{document}
\begin{floattable}
{Potential \tcode{setlocale} data races}
{tab:setlocale.data.races}
{lllll}
\topline

\tcode{fprintf}     &
\tcode{isprint}     &
\tcode{iswdigit}    &
\tcode{localeconv}  &
\tcode{tolower}     \\

\end{floattable}

\end{document}
share|improve this question
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Please also include details on how exactly you're doing the conversion. –  doncherry Dec 3 '12 at 7:36
1  
Thanks! Unfortunately, this is by no means a minimal working example. Please remove all packages that are not strictly necessary to reproduce the problem, and don't use any \input statements, since they just unnecessarily complicate the document for debugging. (If the problem should turn out to be related to \input, that'd be different, of course.) A MWE will look very different from your actual document. Since your document seems to be pretty big, take a look at the link on MWEs I posted, it'll tell you how to efficiently boil your document down to a MWE. –  doncherry Dec 3 '12 at 7:53
    
thanks.. i will try to work on the MWE in coming few days and update the question.. –  RamneekHanda Dec 3 '12 at 8:46
    
added the MWE.. any help please? –  RamneekHanda Dec 4 '12 at 15:12
    
so i figured if i replace \hline with blanks it ourputs as table but doesnt show the bounding lines.. any help on how to replace them so that the table is correctly formatted for html? –  RamneekHanda Dec 4 '12 at 16:48
show 1 more comment

1 Answer

up vote 3 down vote accepted

Well, there are some errors caused by the lack of support for memoir in tex4ht. We fixed that in another question. Now you need to add support for your macros. To do that, you should separate them in package, for example ramneek.sty

\setcounter{totalnumber}{10}

% Base definitions for tables
\newenvironment{TableBase}
{
 \renewcommand{\tcode}[1]{{\CodeStylex{##1}}}
 \newcommand{\topline}{\hline}
 \newcommand{\capsep}{\hline\hline}
 \newcommand{\rowsep}{\hline}
 \newcommand{\bottomline}{\hline}

%% vertical alignment
 \newcommand{\rb}[1]{\raisebox{1.5ex}[0pt]{##1}}    % move argument up half a row

%% header helpers
 \newcommand{\hdstyle}[1]{\textbf{##1}}             % set header style
 \newcommand{\Head}[3]{\multicolumn{##1}{##2}{\hdstyle{##3}}}   % add title spanning multiple columns
 \newcommand{\lhdrx}[2]{\Head{##1}{|c}{##2}}        % set header for left column spanning #1 columns
 \newcommand{\chdrx}[2]{\Head{##1}{c}{##2}}         % set header for center column spanning #1 columns
 \newcommand{\rhdrx}[2]{\Head{##1}{c|}{##2}}        % set header for right column spanning #1 columns
 \newcommand{\ohdrx}[2]{\Head{##1}{|c|}{##2}}       % set header for only column spanning #1 columns
 \newcommand{\lhdr}[1]{\lhdrx{1}{##1}}              % set header for single left column
 \newcommand{\chdr}[1]{\chdrx{1}{##1}}              % set header for single center column
 \newcommand{\rhdr}[1]{\rhdrx{1}{##1}}              % set header for single right column
 \newcommand{\ohdr}[1]{\ohdrx{1}{##1}}
 \newcommand{\br}{\hfill\break}                     % force newline within table entry

%% column styles
 \newcolumntype{x}[1]{>{\raggedright\let\\=\tabularnewline}p{##1}}  % word-wrapped ragged-right
                                                                    % column, width specified by #1
 % \newcolumntype{m}[1]{>{\CodeStyle}l{##1}}              % variable width column, all entries in CodeStyle
 \newcolumntype{m}[1]{l{##1}}                           % variable width column, all entries in CodeStyle
}
{
}

% General Usage: TITLE is the title of the table, XREF is the
% cross-reference for the table. LAYOUT is a sequence of column
% type specifiers (e.g. cp{1.0}c), without '|' for the left edge
% or right edge.

% usage: \begin{floattablebase}{TITLE}{XREF}{COLUMNS}{PLACEMENT}
% produces floating table, location determined within limits
% by LaTeX.
\newenvironment{floattablebase}[4]
{
 \begin{TableBase}
 \begin{table}[#4]
 \caption{\label{#2}#1}
 \begin{center}
 \begin{tabular}{|#3|}
}
{
% \bottomline
 \end{tabular}
 \end{center}
 \end{table}
 \end{TableBase}
}

% usage: \begin{floattable}{TITLE}{XREF}{COLUMNS}
% produces floating table, location determined within limits
% by LaTeX.
\newenvironment{floattable}[3]
{
 \begin{floattablebase}{#1}{#2}{#3}{htbp}
}
{
 \end{floattablebase}
}


\newcommand{\CodeStylex}[1]{\texttt{#1}}
\newcommand{\tcode}[1]{\CodeStylex{#1}}

Now you need to add configuration for tex4ht, so create file ramneek.4ht. This file is loaded automatically when you use package ramneek.

\NewConfigure{TableBase}{2}
\ConfigureEnv{TableBase}{%
\a:TableBase
}{\b:TableBase}{
\renewcommand\topline{}
\renewcommand\bottomline{}
}{}

\Configure{TableBase}{\HCode{<div class="TableBase">\Hnewline}}{\HCode{</div>\Hnewline}}

\Css{
.TableBase .tabular td{
  border-top:1px solid black;
  border-bottom:1px solid black;
}
}

This code patches environment TableBase, it redefines macros \topline and \bottomline which caused problems and it insert configurable hooks. With \Configure{TableBase} we configure this hook to insert <div class=TableBase> and with \Css command you can configure appereance of the table using cascading stylesheets however you want.

share|improve this answer
    
thanks.. will check it tomorrow and accept if it works.. –  RamneekHanda Dec 5 '12 at 14:04
    
Did i tell you - you are awesome? :). tx so much.. –  RamneekHanda Dec 6 '12 at 9:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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