tex4ht 和 tex4ebook:将 tikzcd 放入内联数学时出现的问题

tex4ht 和 tex4ebook:将 tikzcd 放入内联数学时出现的问题

梅威瑟:

\documentclass[oneside]{amsart}

\usepackage{amsmath,amssymb,amsfonts, accents}

% Include the following code before \usepackage{tikz}
\ifdefined\HCode
  \def\pgfsysdriver{pgfsys-dvisvgm4ht.def}
\fi 
\usepackage{tikz}
\usepackage{tikz-cd}

\usepackage{xstring}
\usepackage{mathrsfs}

\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\cat}[1]{
\StrLen{#1}[\mystrlen]
\ifnum\mystrlen=1 \mathscr{#1}
\else \mathrm{#1}
\fi}

\begin{document}

\tableofcontents
  
\section{Something}
\label{sec:a}

\subsection{Else}\label{sec:e}

There is a colimit
$\begin{tikzcd}[cramped]
\cat{X}_0\ar[r] & \cat{X}_1\ar[r] & \mc{X}_2\arrow[r] & \dots\ar[r] & \cat{X}.
\end{tikzcd}$

\end{document}

用 编译make4ht,出现错误:

[WARNING] domfilter: DOM parsing of testse2.html failed:
[WARNING] domfilter: ...ive/2021/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/sub) [char=1066]

使用 编译tex4ebook,同样出现上述错误。此外,ToC 的超链接无效。ToC 的代码html

  <div class='tableofcontents'>   <span class='sectionToc'><a href='#contents' id='QQ2-2-1'>Contents</a></span><br /><span class='sectionToc'> 1.  <a href='testse2.html#something' id='QQ2-3-2'>Something</a></span><br /><span class='subsectionToc'>   1.1.  <a href='testse2.html#else' id='QQ2-3-3'>Else</a></span><br />
  </div>

以及html唯一部分的代码:

<div class="crosslinks"><p class="noindent"></p></div>
  <h3 class="sectionHead"><span class="titlemark">1. </span> <a 
 id="x3-20001"></a>Something</h3>
<!--l. 29--><p class="noindent" ><span class="subsectionHead"><span class="titlemark">1.1. </span> <a 
 id="x3-30001.1"></a><span 
class="ecbx-1000">Else.</span></span>
  There is a colimit <img 
src="test-29e6ea9180db52c3bc6c04bd72320463.svg" alt="

答案1

由于以下 HTML 代码,您会收到 DOM 错误:

 <img 
src="sample0x.svg" alt="

相关内容