使用 htlatex 和 tex4ebook 的多源文档

使用 htlatex 和 tex4ebook 的多源文档

我应该如何使用 tex4ebook 编译包含不同 tex 文件章节的文档?'tex4ebook main.tex' 的输出包含有效的标题页、索引、空白章节和有效的参考书目。

主文件的结构如下:

% ......   
    \includeonly{%
    Miscellaneus/Abstract,%
    Linux_chapters/Chap1,%
    Linux_chapters/Chap2,%
    Linux_chapters/Chap3,%
    Linux_chapters/Chap4,%
    Linux_chapters/Chap5,%
    Linux_chapters/Chap6,%
    Linux_chapters/Chap7,%
    Linux_chapters/Chap9,%
    Linux_chapters/Chap8,%
    Windows_chapters/Chap1,%
    Windows_chapters/Chap2,%
    Windows_chapters/Chap3,%
    Windows_chapters/Chap4,%
    Windows_chapters/Chap8,%
    All_chapters/Final,%
    Miscellaneus/References%
    }

    \newcounter{Item}
    \newcounter{Hfootnote}
    \newcounter{bookmark@seq@number}
    \newcounter{ttl@toc@chapters}

\begin{document}

\begin{titlingpage}

\fontsize{18pt}{20pt}\selectfont

%titling page

\end{titlingpage}

\newpage

\include{Miscellaneus/Abstract}

\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\chapter*{}
\thispagestyle{empty}
\null
\vfill
\begin{center}
\HUGE{\textbf{LINUX}}
\end{center}
\vfill

\phantomsection
\addcontentsline{toc}{part}{LINUX}

\include{Linux_chapters/Chap1}
\include{Linux_chapters/Chap2}
\include{Linux_chapters/Chap3}
\include{Linux_chapters/Chap4}
\include{Linux_chapters/Chap5}
\include{Linux_chapters/Chap6}
\include{Linux_chapters/Chap7}
\include{Linux_chapters/Chap9}
\include{Linux_chapters/Chap8}

\chapter*{}
\thispagestyle{empty}
\null
\vfill
\begin{center}
\HUGE{\textbf{WINDOWS}}
\end{center}
\vfill

\phantomsection
\addcontentsline{toc}{part}{WINDOWS}

\include{Windows_chapters/Chap1}
\include{Windows_chapters/Chap2}
\include{Windows_chapters/Chap3}
\include{Windows_chapters/Chap4}
\include{Windows_chapters/Chap8}

\phantomsection
\addcontentsline{toc}{part}{Final Observations}

%\appendix
\include{All_chapters/Final}
\include{Miscellaneus/References}
\printindex
\end{document}

htlatex 没有给出错误,但只生成标题页的 html

答案1

OP\includeonly在他的项目中有以下命令

\includeonly{%
Miscellaneus/Abstract,%
Linux_chapters/Chap1,%
Linux_chapters/Chap2,%
Linux_chapters/Chap3,%
Linux_chapters/Chap4,%
Linux_chapters/Chap5,%
Linux_chapters/Chap6,%
Linux_chapters/Chap7,%
Linux_chapters/Chap9,%
Linux_chapters/Chap8,%
Windows_chapters/Chap1,%
Windows_chapters/Chap2,%
Windows_chapters/Chap3,%
Windows_chapters/Chap4,%
Windows_chapters/Chap8,%
All_chapters/Final,%
Miscellaneus/References%
}

从这些章节来看,只有Miscellaneus/AbstractMiscellaneus/References真正被包括在内,其他的都没有。这显然是因为_目录名中的字符,它与^因导致各种问题而臭名昭著的一样tex4ht。在这种情况下,这是一个明显的错误。解决这个问题的简单方法是重新定义_catcode:

\catcode`\_=12
\includeonly{%
Miscellaneus/Abstract,%
Linux_chapters/Chap1,%
Linux_chapters/Chap2,%
Linux_chapters/Chap3,%
Linux_chapters/Chap4,%
Linux_chapters/Chap5,%
Linux_chapters/Chap6,%
Linux_chapters/Chap7,%
Linux_chapters/Chap9,%
Linux_chapters/Chap8,%
Windows_chapters/Chap1,%
Windows_chapters/Chap2,%
Windows_chapters/Chap3,%
Windows_chapters/Chap4,%
Windows_chapters/Chap8,%
All_chapters/Final,%
Miscellaneus/References%
}
\catcode`\_=8 % set catcode of `_` to previous value

现在应该正确包含章节了

相关内容