我在尝试将 Latex 文章转换为 OpenOffice 时遇到了一些麻烦。首先,我使用的是 Ubuntu 11.04,安装了texlive
2011 版(通过 安装tlmgr
)。
EDIT1:现在有一个基于给定测试用例的 MWE(这是一个 shell 脚本) - 请参阅文章末尾
这是我正在使用的测试用例:
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).
目前为止已经足够好了 - 但我想oolatex
在这个文档上使用 now;并且由于没有oolatex
in texlive
,我尝试这样做:
mk4ht oolatex mytemp.tex
...并且该过程在以下位置失败:
...
Package hyperref Message: Driver: htex4ht.
...
! Undefined control sequence.
<argument> \headerps@out
{/burl@stx null def /BU.S { /burl@stx null def } de...
l.306 }
现在,我在某处找到了这一行\def\headerps@out#1{\special{! #1}}%
,如果我把它添加到我的序言中:
...
\spaceskip=3.5pt plus1.47pt minus0.77pt \makeatother
\makeatletter
\def\headerps@out#1{\special{! #1}}%
\makeatother
\usepackage{times}
...
然后它似乎被注册了 - 如果我尝试再次构建,该过程将失败并出现另一个错误:
$ mk4ht oolatex mytemp.tex
...
! Undefined control sequence.
<argument> ...\a:mathml columnlines="\columnlines
" \a:mathml equalcolumns="...
l.203 G
_2\\[1pt] G_1\\
?
有人知道如何将上述示例构建为 OpenOffice 文档吗?
非常感谢您的任何回答,
干杯!
EDIT1:这是一个MWE文件,揭示了完全相同的问题:
\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}
答案1
啊该死——我应该看起来更好;)
好吧,如果我们更仔细地看一下第二个错误:
! Undefined control sequence.
<argument> ...\a:mathml columnlines="\columnlines
" \a:mathml equalcolumns="...
...这是非常明显的,由于换行符,这\columnlines
就是问题所在;所以我对此进行了更多的搜索 - 发现这是一个 2009 年已知的错误:[tex4ht] 错误报告:oolatex 损坏:
这是由于未初始化的宏 \columnlines 造成的。一个快速而粗略的技巧是在文档顶部插入以下行:
\let\columnlines\empty
这个错误将在不久的 TeX4ht 下一版本中修复。
因此,正如文章中所述,只需在部分\let\columnlines\empty
之后添加即可\def\headerps@out
- 最后,mk4ht oolatex ...
顺利通过:)
(不过我注意到,数学在 .odt 中呈现为图像,并且分页没有保留 - 因为页边距(显然还有字体大小)没有保留...)。
好吧,希望这也能帮助其他人,
干杯!
编辑:该死 - 事实证明,这个\columnlines
东西本质上是重复的:mathmode - 使用 mk4ht oolatex 将 Latex 转换为 ODF/DOC 导致方程数组失败 - TeX - LaTeX - Stack Exchange... 啊没关系:)