我正在尝试在 tex4ht 中生成度数符号(最好使用生成 pdf 的相同代码)
PDF 在显示度数符号的所有不同方式下都能正常工作,但 html 文档仅将圆圈部分提升到线的中间。据我所知,mathjax 也没有解决这个问题。
\documentclass{report}
\usepackage{enumitem}
\usepackage{siunitx}
\newcommand{\degC}{$\,^{\circ}\mathrm{C}$ }
\begin{document}
\begin{itemize}[noitemsep] % sets no itemsep for just this list
\item siunitx example that doesn't work: \SI{-80}{\degreeCelsius}
\item siunitx is hopefully not the problem because this doesn't work either when compiling with htlatex: -80\degC
\item $-80$\degC
\end{itemize}
\end{document}
下面是 html 排版结果的副本:(圆圈不是上标。)
- siunitx 示例不起作用:-80 ∘C
- 希望 siunitx 不是问题,因为使用 htlatex 编译时这也不起作用:-80∘C
- -80∘℃
有没有办法让该\circ
命令与 tex4ht 一起用于 html。我确信,如果我能让常规命令工作,我就能让 siunitx 工作。
答案1
加载textcomp
和使用\textdegree
:
\documentclass{report}
\usepackage{textcomp}
\usepackage{enumitem}
\usepackage{siunitx}
\sisetup{
math-celsius=\mbox{\textdegree C},
text-celsius=\textdegree C,
}
\begin{document}
\begin{itemize}[noitemsep] % sets no itemsep for just this list
\item siunitx example that doesn't work: \SI{-80}{\degreeCelsius}
\item siunitx example with math $\SI{-80}{\degreeCelsius}$
\end{itemize}
\end{document}
如果我编译
htlatex engbird "xhtml, charset=utf-8" " -cunihtf -utf8"
我明白了
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
<!-- xhtml,charset=utf-8,html -->
<meta name="src" content="engbird.tex" />
<meta name="date" content="2015-01-15 01:03:00" />
<link rel="stylesheet" type="text/css" href="engbird.css" />
</head><body
>
<ul class="itemize1">
<li class="itemize">siunitx example that doesn’t work: −80 <span
class="tcrm-1000">°</span>C
</li>
<li class="itemize">siunitx example with math −80 <span
class="tcrm-1000">°</span>C</li></ul>
</body></html>