為什麼是 tspan 而不是 class?斜體不是使用 htlatex 渲染的

為什麼是 tspan 而不是 class?斜體不是使用 htlatex 渲染的

與“html,fn-in”一起使用時htlatex,生成的html有

<tspan font-family="cmti" font-size="10">should be italics </tspan>

但這不會在 html 中呈現(至少在 chrome 和 safari 中不會)。

一個簡單的

<span class "cmti-10x-x-109">finally italics </span>

會完美地工作。

問題不是真正的 html,而是我從中產生的 epub 也沒有呈現的事實...使用 ebook-convert

(我正在使用該memoir包。)

我該如何解決這個問題?

編輯 這是一個最小的例子:

\documentclass[a5paper,11pt]{memoir}

\usepackage{tikz}

%% Below just a command to show colors
\newcommand*{\titleTH}{\begingroup
\raggedleft
\vspace*{\baselineskip}
{\large Welcome to}\\[0.167\textheight]
{\Large \bfseries Something}\\[\baselineskip]
{\textcolor{red}{\Huge Red}}\\[\baselineskip]
{\small No reason to be scared\\}\par
\vfill
{QED}\par
\vspace*{3\baselineskip}
\begin{tikzpicture}[overlay, remember picture]
%% Here there was the loading of a picture
\end{tikzpicture}
\endgroup}


\begin{document}

\pagestyle{empty}

% Commenting out this line would make the following text render right
\titleTH

\newpage

Here I write \textit{the part that should be} italics, \textbf{D'OH!}

\結束{文件}

問題似乎是 tikz 包,因為麥可.h21建議。

答案1

tikz使用 執行時,在每張圖片中配置很多東西tex4ht。不幸的是,這些配置之一是全域性的,甚至在圖片結束後仍然存在,並且它是用於捕獲字體變更的配置。

您可以嘗試使用此.cfg檔案在每個 tikz 圖片結束後將此配置重設為正常值:

\Preamble{xhtml}
\begin{document}
\makeatletter
\let\old@endpicture\pgfsys@endpicture
\def\pgfsys@endpicture{%
  \Configure{htf}{0}{+}{<span\Hnewline%
     class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}%
  \old@endpicture%
}
\makeatother
\EndPreamble

運行它

htlatex filename cfgname

或者

make4ht -c cfgname.cfg filename

結果:

在此輸入影像描述

相關內容