hlatex 和表格的问题

hlatex 和表格的问题

请考虑以下最小工作示例,我们称之为mintab.tex(基于这里

\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}

这个可以用 构建pdflatex mintab.tex;但是,如果我发出htlatex mintab.tex,它会失败:

$ 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\\
? 

如果取消注释“typeouts”,则会得到 PDF 案例的结果:

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

在这种htlatex情况下,它“崩溃”了,你必须按几次 ENTER 才能列出所有错误:

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

奇怪的是,你甚至无法展示这一点\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?)

好吧,有人有想法吗,我该如何修改这个文件以便它也可以构建htlatex

答案1

\toprule如果您加载 booktabs,删除、、和\midrule的(重新)定义,并将其更改为,则文件可以正常编译,至少可以使用。\botrule\hline\@xhline\botrule\bottomrulehtlatex

相关内容