Tell me more ×
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 in the process of trying to generate an HTML version of a report that was previously only PDF. Unfortunately, thus far my efforts with tex4ht have been some what fruitless.

The target output I am looking for should be in the neighborhood of this:

enter image description here

The actual output I am getting from tex4ht unfortunately looks like this:

enter image description here

This is the source latex I am working from:

\documentclass{article}
\usepackage[landscape,margin=1.5cm,includehead,includefoot]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage[table]{xcolor}
\usepackage{tabularx,booktabs,colortbl,multirow}
%\usepackage{lipsum} % just to generate some text

% some space
\newcommand\TSpace{\hspace*{\tabcolsep}}

\setlength\parindent{0pt}

% definition of the page style with required header and footer
\newpagestyle{repstyle}{%
   \renewcommand{\makefootrule}{%
    \color{gray!70}\makebox[0pt][l]{\rule[.9\baselineskip]{\linewidth}{2pt}}}
   \renewcommand{\makeheadrule}{%
    \color{gray!70}\makebox[0pt][l]{\rule[\baselineskip]{\linewidth}{2pt}}%
      \rule[-.5\baselineskip]{\linewidth}{2pt}}
  \sethead
    {\footnotesize\bfseries\TSpace Balance Payments Report -- National}
    {}
    {\footnotesize\bfseries Generated by UserName \today\hspace{2cm}\thepage\TSpace}
  \setfoot{\footnotesize\bfseries\TSpace Reference Code:  SH1SP1SD1DS20110426DE20110426GB3OB1DN1234}{}{}
}

\pagestyle{repstyle}

\newcolumntype{A}{>{\footnotesize}X}
\newcolumntype{B}[1]{>{\footnotesize}p{#1}}
\newcolumntype{C}{>{\footnotesize}c}

% using sans serif font in the document
\renewcommand{\familydefault}{\sfdefault}

\newcommand\Heading[2]{%
\begin{tabularx}{\textwidth}{Xl@{}X}
  \multirow{2}{*}{\huge\bfseries Balance Payments} & #1--#2
    & Grouped by Region, and ordered by Date / Time \\
  & Restricted to Historical, Pending &
\end{tabularx}\vspace{1ex}
}

% command for writting the first two lines of the payments (Midwest, and Date, Customer Name, etc.). The mandatory argument declares the region: "Midwest", or "East"
\newcommand\RegHeading[1]{%
  \hiderowcolors
  \toprule[1.5pt]\addlinespace[1.5ex]
  \large\bfseries #1 \\ \arrayrulecolor{gray!70}
  \midrule[0.8pt]
  \small\bfseries Date & \small\bfseries Customer Name
    & \small\bfseries Number &   \small\bfseries Sales Rep Name
    & \small\bfseries Balance & \small\bfseries Payment Method
    & \small\bfseries Total \\
  \showrowcolors
}

% command for writting the four last rows (Totals for Midwest, Checking Account, Credit Card and Net Total). Arguments: region, check. acc. total, credit card total, net total.
\newcommand\RegTotal[4]{%
  \hiderowcolors
  \bottomrule[1.5pt]\addlinespace[.3ex]
  Totals for #1 \\
  \midrule
  \multicolumn{2}{l}{\hspace{10pt}\footnotesize Checking Account} &&&&& #2 \\
  \midrule
  \multicolumn{2}{l}{\hspace{10pt}\footnotesize Credit Card} &&&&& #3 \\
  \midrule
  Net Total &&&&&& #4 \\
}


\begin{document}

\Heading{04/26/2011}{04/26/2011}

\rowcolors{1}{blue!10}{}
\arrayrulecolor{black!70}

\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\RegHeading{Midwest}
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
\RegTotal{Midwest}{1.00}{1.00}{2.00}
\end{tabularx}

\rowcolors{1}{blue!10}{}
\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\RegHeading{East}
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
\RegTotal{East}{1.00}{1.00}{2.00}
\end{tabularx}

\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\toprule[1.5pt]\addlinespace[1.5ex]
\large\bfseries Grand Totals \\\arrayrulecolor{gray!70}
\midrule[0.8pt]
\multicolumn{2}{l}{\hspace{10pt}\footnotesize Checking Account} &&&&& 1.00 \\
\midrule
\multicolumn{2}{l}{\hspace{10pt}\footnotesize Credit Card} &&&&& 1.00 \\
\midrule
Net Total &&&&&& 2.00 \\
\bottomrule
\multicolumn{2}{l}{\scriptsize 8 transactions accounted for.}
\end{tabularx}

\end{document}

At this time I am not using any special configuration, just the calling "htlatex report.tex"

Any recommendations would be appreciated.

share|improve this question
At this time, compiling your document as-is with TL2011 gives me ./report.tex:85: Misplaced \noalign. \n:midrule: ->\o:noalign: {\ifnum 0=}\fi \let \cur:rule \a:midrule \gobble:...` – cjorssen Nov 1 '11 at 20:19
Those tables look the same to me. What I mean is that just from what you show, the difference could be purely CSS (it depends on their actual structure which isn't visible from a screenshot). As far as I know, TeX4ht doesn't generate more than rudimentary CSS but it wouldn't be hard to write a stylesheet to match the first table. – Andrew Stacey Nov 2 '11 at 10:20
@cjorssen, yes you are correct. I'm trying to debug that now (I was ignoring warnings). Its weird because that error only occurs when building with tex4ht. – Jeffrey Fuller Nov 2 '11 at 17:07
@AndrewStacey, sort of. There are a few errors in the tex markup that result in broken tables in the tex4ht rendering, but it doesn't do the striping as far as I can tell, and the layout of the header is jacked. I'm working through what I can with CSS in the mean time though. I think I might have to put in some conditional formatting for html vs pdf in the tex – Jeffrey Fuller Nov 2 '11 at 17:09

closed as too localized by egreg, Marco Daniel, lockstep, Joseph Wright Apr 14 '12 at 22:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.