[Tex/LaTex] Problems building article with oolatex and hyperref

hyperrefopen-officetex4ht

I'm getting into a bit of trouble, trying to convert a Latex article to OpenOffice. First of all, I'm using Ubuntu 11.04, with a texlive 2011 installation (installed via tlmgr).


EDIT1: There is now a MWE based on the test case given (which is a shell script) – see at end of post


Here is the test case I'm working with:

mkdir tmp && cd tmp
wget http://www.inderscience.com/www/download/latex_singlecolumn_2010.zip
unzip latex_singlecolumn_2010.zip
cd Single-column/Single-column/
ln -s ../../singlecol-new.cls . # symlink class file in top dir

# make a copy to a test latex file:
cp IJDMB-4\(4\)07-MullahandEguchi.tex mytemp.tex
# hack temp latex file; end of its preamble at "\spaceskip=3.5pt..." line
sed -ri 's_^\\spaceskip(.*)_    \\spaceskip\1        \\usepackage{times}    \\usepackage{url}    \\usepackage[breaklinks]{hyperref}    \\usepackage{breakurl}    \\hypersetup{colorlinks=, linkcolor=, citecolor=, filecolor=, urlcolor=}    % hack for math in sections:    \\let\\oldsection\\section    \\def\\
mpl{\\oldsection[]}    \\let\\section\\
mpl        _' mytemp.tex

# do a test run
pdflatex mytemp.tex
# OK: Output written on mytemp.pdf (12 pages, 249090 bytes).

Good enough for now – but I'd like to use oolatex now on this doc; and since there's no oolatex in texlive, I try this:

mk4ht oolatex mytemp.tex

… and the process fails at:

...
Package hyperref Message: Driver: htex4ht.
...
! Undefined control sequence.
<argument> \headerps@out
                         {/burl@stx null def /BU.S { /burl@stx null def } de...
l.306 }

Now, I found somewhere the line \def\headerps@out#1{\special{! #1}}%, and if I add it to my preamble here:

...
\spaceskip=3.5pt plus1.47pt minus0.77pt \makeatother

\makeatletter
\def\headerps@out#1{\special{! #1}}%
\makeatother

\usepackage{times}
...

then it seems to get registered – and if I try to build again, the process fails with another error:

$ mk4ht oolatex mytemp.tex
...
! Undefined control sequence.
<argument> ...\a:mathml columnlines="\columnlines
                                                  " \a:mathml equalcolumns="...
l.203 G
       _2\\[1pt] G_1\\
?

Anyone have an idea how could I get the above example to build as OpenOffice document?

Many thanks in advance for any answers,
Cheers!


EDIT1: Here is a MWE file that reveals the exact same problem:

\documentclass{article}

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

\def\bmD{\mbox{\boldmath $D$}}          %99.10.1
\def\bmE{\mbox{\boldmath $E$}}        %99.6.29
\def\bmG{\mbox{\boldmath $G$}}
\def\h{\hbox}

\usepackage{natbib}

% \makeatletter
% \def\headerps@out#1{\special{! #1}}%
% \makeatother

\usepackage{times}
\usepackage{url}
\usepackage[breaklinks]{hyperref}
\usepackage{breakurl}
\hypersetup{colorlinks=, linkcolor=, citecolor=, filecolor=, urlcolor=}
% hack for math in sections:
% see http://tex.stackexchange.com/a/50854/2595
\makeatletter
\let\oldsection\section
%
\renewcommand{\section}{\@ifstar
                     \mysectionStar%
                     \mysectionNoStar%
}
\newcommand{\mysectionStar}[1]{  % no two arguments here?
\typeout{AAAA}% debug
\oldsection{#1}}
\newcommand{\mysectionNoStar}[1]{ %
\typeout{BBBB}% debug
\oldsection[TOC-ENTRY:\thesection]{#1} }
%
\makeatother



\begin{document}


\title{Robust QTL analysis by minimum ${\bm\beta}$-divergence method}
% \title{Robust method}

\maketitle

\section{Introduction}

The basic methodology for mapping QTLs involves arranging a
cross between two inbred strains differing substantially in a
quantitative trait: segregating progeny are scored both for the
trait and for a number of genetic markers. A cross between two
parental inbred lines $P_1$ and $P_2$ is performed to produce
an $F_1$ population. .... \cite{Zeng94} named this
combination as~CIM.

\section{Genetic model}\label{modelMLE}

Let us consider a QTL in the backcross population in which the
frequencies of genotypes $QQ$ and $Qq$ are $1/2$ and $1/2$,
respectively. The genetic model for a QTL is as follows:
\[
\bmG =
\begin{bmatrix}
G_2\\[1pt] G_1\\
\end{bmatrix}
=
\begin{bmatrix}
1\\[1pt] 1\\
\end{bmatrix}
\mu +
\begin{bmatrix}
1/2\\[2pt] -1/2\\
\end{bmatrix}
[a] ={\bf 1}_{2\times 1}\mu+\bmD\bmE.
\]

\section{Robust QTL analysis by CIM model based on minimum\\
 ${\bm\beta}$-divergence estimators}\label{BetaDivergence}

The $\beta$-divergence between two probability density
functions $p(u)$ and $q(u)$ is defined~as
\[
D_{\beta}{(p, q)}
=\int\bigg[\frac{1}{\beta}\big\{p^\beta(u)-q^\beta(u)\big\}p(u)
-\frac{1}{\beta+1}\big\{p^{\beta+1}(u)-q^{\beta+1}(u)\big\}\bigg]{\rm
d}u,
\]
for $\beta>0$.

\section*{Conclusion}\label{Conclusion}

This paper discusses a new robust QTL mapping algorithm based
on CIM model in an experimental organisms by minimising
$\beta$-divergence using the EM like algorithm.
... However, $R_\beta$ should satisfy $0\leq{R_\beta}\leq 1$
\citep{Basu98}.


\begin{thebibliography}{10}

\bibitem[\protect\citeauthoryear{Basu et~al.}{1998}]{Basu98}
Basu, A., Harris, I.R., Hjort, N.L. and Jones, M.C. (1998)
`Robust and efficient estimation by minimising a density power
divergence', {\it Biometrika}, Vol.~85, pp.549--559.

\bibitem[\protect\citeauthoryear{Zeng}{1994}]{Zeng94}
Zeng, Z.B. (1994) `Precision mapping of quantitative trait
loci', {\it Genetics}, Vol.~136, \h{pp.1457--1468}.

\end{thebibliography}

\end{document}

Best Answer

Ah darn it - I should have looked better ;)

Well, if we look at the second error more closely:

! Undefined control sequence.
<argument> ...\a:mathml columnlines="\columnlines
                                                  " \a:mathml equalcolumns="...

... it is quite noticeable, due to the linebreak, that \columnlines is the problem; so I searched a bit more on that - and it turns out it's a know bug from 2009: [tex4ht] Bug Report: oolatex broken:

That was due to the uninialized macro, \columnlines. A quick and dirty trick will be to insert the following line at the top of your document:

\let\columnlines\empty

The bug will be fixed in the next release of TeX4ht which is not far off.

So, as noted in the post, just add \let\columnlines\empty right after the \def\headerps@out part - and finally, mk4ht oolatex ... passes without a problem :) (I'm noting however, that math is rendered as images in the .odt, and pagination is not preserved - as page margins (and apparently font sizes) are not preserved...).

Well, hope this helps others too,
Cheers!


EDIT: Darn it - and it turns out, the \columnlines thing is essentially a duplicate here: mathmode - Latex to ODF/DOC using mk4ht oolatex failing on equation arrays - TeX - LaTeX - Stack Exchange ... ah, nevermind :)

Related Question