我有一份用 LaTeX 编写的手稿。经过几次拒绝和修改后,新杂志似乎只接受 .docx 文件。我打算将我的手稿转换为 .odt,因为编辑很乐意使用这种格式。
这是一个我正在尝试转换的小型、非最小但独立的文档 (Test.tex):
\documentclass[a4paper,12pt]{article}
\usepackage{microtype}
\title{Germination of Avocado using special germination media}
\author{E.Sandoval \thanks{[email protected]}}
\usepackage[mode=text]{siunitx}
\begin{document}
\maketitle
\iffalse
\begin{abstract}
Avocado seeds from Guatemala were sterilised and de-hulled incubated in DBB special salt media. Three controls were employed. As first control, de-hulled seeds were germinated in saline. As second control, the seeds were were modified and were incubated in DBB media. As the third control, the unmodified seeds were incubated in saline.\par
Germination with de-hulled DBB media took 5 days, de-hulled and saline took 12 days, unmodified and DBB took 15 days, and unmodified with saline took 16 days.\par
This suggests that rapid germination can be achieved with the new DBB media.
\end{abstract}
\newpage
\section{Introduction}
This is going to be a long introduction about something. I think it would be very interesting to write about other studies on Avocado germination and what they found. Explain why you want to investigate this in context of previous studies and the specific problem you are addressing.\par
\fi
Seeds were incubated in \qty{23.06}{\milli\litre} of media.\par
\end{document}
我正在使用以下命令:htlatex Test.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo -cvalidate"
在上面的代码中,\iffalse
和之间的部分\fi
只是文本,并且在之前的测试运行中可以顺利转换为 .odt 文件,没有任何问题。但是,当我尝试使用该包时,错误开始出现siunitx
。并添加行Seeds were incubated in \qty{23.06}{\milli\litre} of media.
我收到错误:
! Missing number, treated as zero.
<to be read again>
^
l.35 \catcode`\^^
A=\catcode`\%
?
! Emergency stop.
<to be read again>
^
l.35 \catcode`\^^
A=\catcode`\%
Output written on Test.dvi (53 pages, 15472 bytes).
Transcript written on Test.log.
相应的Test.log
文件非常庞大,确实找不到任何有用的信息(至少对于我这双外行的眼睛来说)。
我并不是想在这里装傻,但似乎没有很好的资源来编写 .cfg 文件。这里的所有示例似乎都超出了我的理解范围!
答案1
首先,不要使用htlatex
,它已被弃用,请改用make4ht
。它对于 ODT 输出尤其重要,因为它执行获取有效 ODT 文件所必需的各种后处理任务。
关于这个错误,它似乎是由以下行引起的siunitx.sty
:
\AtBeginDocument { \RequirePackage { color } }
这会导致在处理 TeX4ht 配置文件时出现一些 catcode 问题。为了解决这个问题,我们可以提前加载 Color 包,例如使用这个配置文件:
\RequirePackage{color}
\Preamble{xhtml}
\begin{document}
\EndPreamble
您可以使用此命令来编译您的示例:
$ make4ht -c config.cfg -f odt Test.tex
结果如下: