TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


\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

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

\def\hline{\noalign{\ifnum0=`}\fi\hrule \@height .5pt \futurelet

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

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


\hypersetup{colorlinks=, linkcolor=, citecolor=, filecolor=, urlcolor=}


\title{Testing of tabular}



Test here:

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

\caption{Conditional probabilities of a putative QTL genotype given
the flanking marker genotypes for a backcross population}
\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
{\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


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]
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:

\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


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

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

Runaway argument?
! Paragraph ended before \g:Advance was complete.
<to be read again> 
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


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

? i
> \g=undefined.
<insert>  \show\g
l.59 \toprule{} &
                   & \multicolumn{2}{c}{\it QTL genotypes} \down\\

I'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?

share|improve this question
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
up vote 3 down vote accepted

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.

share|improve this answer
Thanks for the answer, @egreg - cheers! – sdaau May 6 '12 at 8:26

Your Answer


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.