我正在尝试使用 TeX4ht(在 Windows/MiKTeX 2.9 32 位上)将 LaTeX 文档转换为 opendocument。我正在使用以下命令(按照TeX4ht 网站):
D:\latex>htlatex mwe.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo -cvalidate"
我的mwe.tex
读物:
\documentclass{minimal}
\begin{document}
Hello World
\end{document}
LaTeX 调用htlatex.bat
运行良好,但tex4ht
调用给出错误Illegal storage address
:
D:\latex>tex4ht mwe.tex -i/tex4ht/ht-fonts/"ooffice/! -cmozhtf" -ewin32/tex4ht.env
----------------------------
tex4ht.c (2010-12-16-08:39 Windows MiKTeX)
tex4ht mwe.tex
-i/tex4ht/ht-fonts/ooffice/!
-cmozhtf
-ewin32/tex4ht.env
(C:/Program Files (x86)/MiKTeX 2.9/tex4ht/base/win32/tex4ht.env)
(C:/Program Files (x86)/MiKTeX 2.9/fonts/tfm/public/amsfonts/cmextra/cmbsy5.tfm)
(C:/Program Files (x86)/MiKTeX 2.9/tex4ht/ht-fonts/alias/cm/cmbsy.htf)
Searching `cmsy.htf' for `cmbsy5.htf'
(C:/Program Files (x86)/MiKTeX 2.9/tex4ht/ht-fonts/unicode/cm/cmsy.htf)
--- error --- Illegal storage address
D:\latex>t4ht mwe.tex "-coo -cvalidate" -ewin32/tex4ht.env
----------------------------
t4ht.c (2010-12-16-08:47 MiKTeX)
t4ht mwe.tex
-coo
-cvalidate
-ewin32/tex4ht.env
(C:/Program Files (x86)/MiKTeX 2.9/tex4ht/base/win32/tex4ht.env)
Entering mwe.lg
Entering mwe.css
Entering mwe.tmp
cmbsy.htf
并且cmsy.htf
都位于指定位置。那么这里出了什么问题呢?
我已经发现这个解决方法由 Ulrike Fischer (德语) 撰写,但我的tex4ht.env
已经包含相对路径 (tex4ht.env
日期为 2011 年 7 月 12 日,解决方法是从 2011 年 6 月 17 日开始的,所以我猜这个问题已经解决了),而且我没有oolatex.bat
。C:\Program Files (x86)\MiKTeX 2.9\scripts\tex4ht
脚本htlatex.bat
文件夹中的内容为:
latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input %1
latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input %1
latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input %1
tex4ht %1 -i/tex4ht/ht-fonts/%3 -ewin32/tex4ht.env
t4ht %1 %4 -ewin32/tex4ht.env
答案1
这里第一个问题是,minimal
显然不支持tex4ht
转换为 odt,可能缺少一些配置。但minimal
doc 类不建议用于正常使用,所以应该没问题。只需使用article
document 类即可。
第二个问题是你的命令行,最好使用
mk4ht oolatex mwe
而不是你的版本