1

Please consider the following minimal working example, let's call it mintab.tex (based on the example in here)

\documentclass{article}

\makeatletter
\def\toprule{\noalign{\ifnum0=`}\fi \hrule \@height 2.0pt \hrule
\@height 2pt \@width 0pt \futurelet\@tempa\@xhline}

\def\midrule{\noalign{\ifnum0=`}\fi \hrule \@height 2pt \@width 0pt
\hrule \@height 0.7pt \hrule \@height 2pt \@width 0pt
\futurelet\@tempa\@xhline}

\def\botrule{\noalign{\ifnum0=`}\fi \hrule
\@height 2pt \@width 0pt \hrule \@height 2.0pt
\futurelet\@tempa\@xhline}

\def\hline{\noalign{\ifnum0=`}\fi\hrule \@height .5pt \futurelet
  \reserved@a\@xhline}
\def\@xhline{\ifx\reserved@a\hline\vskip\doublerulesep
  \vskip-0.5pt\fi\ifnum0=`{\fi}}

\def\HD#1#2{\vrule height #1pt depth #2pt width 0pt\relax}
\newcommand{\up}{\HD{12}{0}}% for tables
\newcommand{\down}{\HD{6}{6}}%

%%%% for htlatex:
\def\headerps@out#1{\special{! #1}}%
\newlength{\columnlines}
\setlength{\columnlines}{0.1 pt}
\makeatother

\usepackage{amsmath,amsfonts,amssymb,bm,latexsym}


\usepackage{times}
\usepackage{url}
\usepackage[breaklinks]{hyperref}
\usepackage{breakurl}
\hypersetup{colorlinks=, linkcolor=, citecolor=, filecolor=, urlcolor=}


\begin{document}

\title{Testing of tabular}

\maketitle

\section{Introduction}

Test here:

% \typeout{HEREEEEEE}
% \typeout{\show\toprule}
% \show\toprule
% \typeout{OUT}

\begin{table}[!h]%t1
\caption{Conditional probabilities of a putative QTL genotype given
the flanking marker genotypes for a backcross population}
{\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lccc@{}}
\toprule{} &  & \multicolumn{2}{c}{\it QTL genotypes} \down\\
\cline{3-4}\up {\it Marker genotypes}& {\it Expected frequency} &
{$QQ(p_{j1})$} & {$Qq(p_{j2})$}\\ \midrule ${MN}/{MN}$
&$(1-r_{MN})/4$ & $1$ & $0$\\[2pt] ${MN}/{Mn}$   &$r_{MN}/2$ &$1-p$
&$p$\\[2pt] ${MN}/{mN}$       &$r_{MN}/4$ &$p$       &$1-p$\\[2pt]
${MN}/{mn}$ &$(1-r_{MN})/2$ &$0$         &$1$\\ \botrule
\end{tabular*}}
{\vskip2pt Here $p=r_{MQ}/r_{MN}$, where $r_{MQ}$ is the
recombination fraction between the left marker M and the putative QTL
and $r_{MN}$ is the recombination fraction between two flanking
markers M and N. The possibility of a double recombination event in
the interval is ignored.} \vskip-12pt
\end{table}

\end{document}

This one builds fine with pdflatex mintab.tex; however, if I issue htlatex mintab.tex, it fails with:

$ htlatex mintab.tex
...
(/path/to/texlive/2011/texmf-dist/tex/latex/psnfss/ot1pcr.fd) [3]
[4]
l.58 --- TeX4ht warning --- empty \PopStack\Table:Stck\TableNo? ---
l.58 --- TeX4ht warning --- extra \RecallEndP ---
! Missing } inserted.
<inserted text> 
                }
l.58 \toprule{} &
                   & \multicolumn{2}{c}{\it QTL genotypes} \down\\
? 

If you uncomment the "typeouts", this is what you get for the PDF case:

HEREEEEEE
\show \noalign {\hrule height2.0pt \hrule height2pt width0pt \futurelet }
> \toprule=macro:
->\noalign {\ifnum 0=`}\fi \hrule \@height 2.0pt \hrule \@height 2pt \@width 0p
t \futurelet \@tempa \@xhline .
l.52 \show\toprule

? 
OUT

and for the htlatex case, it 'crashes' and you have to press a ENTER a couple of times to list through all the errors:

HEREEEEEE
! Argument of \g:Advance has an extra }.
<inserted text> 
                \par 
l.51 \typeout{\show\toprule}

? 
Runaway argument?
! Paragraph ended before \g:Advance was complete.
<to be read again> 
                   \par 
l.51 \typeout{\show\toprule}

? 
Runaway text?
\show \let \mth:op \advance \let \bgroup \def \def 0{1}{\par }\tmp:cnt \ETC.
! Forbidden control sequence found while scanning text of \write.
<inserted text> 
                }
l.51 \typeout{\show\toprule}

? 
\show \let \mth:op \advance \let \bgroup \def \def 0{1}{\par }\tmp:cnt \bgroup 
\def \def 0{1}{\afterassignment }\tmp:cnt \afterassignment \afterassignment \xd
ef \def 0{1}{0}\egroup \mth:op \tmp:cnt \xdef \def 0{1}{0}\egroup \mth:op \tmp:
cnt \def 1{0}\futurelet \def 0{1}\def \bgroup \def \def 0{1}{1}\tmp:cnt 1\after
assignment \xdef \def 0{1}{0}\egroup \mth:op \tmp:cnt {\bgroup \def \def 0{1}{1
}\tmp:cnt 1\afterassignment \xdef \def 0{1}{0}\egroup \mth:op \tmp:cnt }\bgroup
 \def \def 0{1}{1}\tmp:cnt 1\afterassignment \xdef \def 0{1}{0}\egroup \mth:op 
\tmp:cnt by 1 \vtop {\let \prOteCt \relax \Protect \gl:nopartrue \vtop {\let \p
rOteCt \relax \Protect \gl:nopartrue \hrule height2.0pt \hrule height2pt width0
pt \futurelet cmyk 0 0 0 0}} 
> \toprule=macro:
->\noalign {\ifnum 0=`}\fi \hrule \@height 2.0pt \hrule \@height 2pt \@width 0p
t \futurelet \@tempa \@xhline .
l.52 \show\toprule

? 
OUT

Strangely, you cannot even show this \g:Advance:

? i
insert>\show\g:Advance
> \g=undefined.
<insert>  \show\g
                 :Advance
l.59 \toprule{} &
                   & \multicolumn{2}{c}{\it QTL genotypes} \downI'm pretty sure this has something to do with the `\toprule` command, but I cannot tell what (maybe the backtick?)

Well, anyone have an idea, how I can modify this file so it also builds with htlatex?

  • 1
    If you load booktabs, remove the (re)definitions of \toprule, \midrule, \botrule, \hline and \@xhline, changing \botrule into \bottomrule, the file compiles. – egreg Apr 6 '12 at 13:29
  • Many thanks for that @egreg - indeed, it builds, and the table is fine in HTML! Also \def\botrule{\bottomrule} worked for me. The problem is - I originally wanted to run mk4ht oolatex mintab.tex, which failed the same way; now the mk4ht oolatex passes fine - but only table headers are output, no table data rows. Any ideas how to fix that? Thanks again - cheers! – sdaau Apr 6 '12 at 13:46
  • Sorry, no idea. I never use the .odt format, so I've never been interested in transforming LaTeX to that format. – egreg Apr 6 '12 at 13:53
  • Cheers @egreg - thanks for the feedback! – sdaau Apr 6 '12 at 13:54
3

If you load booktabs, remove the (re)definitions of \toprule, \midrule, \botrule, \hline and \@xhline, changing \botrule into \bottomrule, the file compiles fine, at least with htlatex.

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.