`make4ht`、`htlatex`:在绝对文件路径上调用时会出错

`make4ht`、`htlatex`:在绝对文件路径上调用时会出错

对于这个问题,我使用以下.tex文件:

\documentclass[fontsize=16pt, paper=letter]{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{amsmath}

\begin{document}

\title{A test \LaTeX to HTML page}
\maketitle

\section{Section One}

Hello world. Here is some mathematics:
    \begin{equation}
        x + y = 3
    \end{equation}

\end{document}

我运行了以下命令(注意目录中的句号/句号):

make4ht "A:\test_tex_sources\test_article.tex" 

但随后我收到以下错误:

> make4ht "A:\test_tex_sources\test_article.tex"
Output dir:
Compiler:       latex
Latex options:   -jobname=A:\test_tex_sources\test_article
tex4ht.sty :    xhtml,
tex4ht
build_file      A:\test_tex_sources\test_article.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding:         ext     dvi
LaTeX call: latex  -jobname=A:\test_tex_sources\test_article  \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 xhtml,.a.b.c.\input A:\test_tex_sources\test_article
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/W32TeX) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2015/10/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
! Undefined control sequence.
<*> ...keatother\HCode xhtml,.a.b.c.\input A:\test
                                                  _tex_sources\test_article
?

但是,如果我切换到包含该文件的目录.tex,然后运行:

make4ht test_article.tex

一切正常。

使用绝对文件路径有什么问题?

答案1

在你的情况下切换

make4ht "A:\test_tex_sources\test_article.tex"

make4ht "A:/test_tex_sources/test_article.tex"

应该可以解决问题。即使在操作系统中路径中有反斜杠,我们也会将其更改为 TeX 工具的斜杠。

相关内容