I am trying to produce a degree sign in tex4ht (ideally with the same code that produces the pdf)

The PDF works fine in all of the different ways of displaying the degree sign, but the html document only partly raises the circle to the middle of the line. From what I can tell mathjax doesn't fix this either.

\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}


Below is a copy of the html typeset result: (circles aren't superscripts.)

• siunitx example that doesn’t work: -80 ∘C
• siunitx is hopefully not the problem because this doesn’t work either when compiling with htlatex: -80∘C
• -80∘C

Is there a way for the \circ command to work with tex4ht for html. I would be sure that if I can get the regular command to work, I would be able to get siunitx working.

Load textcomp and use \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}


If I compile with

htlatex engbird "xhtml, charset=utf-8" " -cunihtf -utf8"


I get

<?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"
>
<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" />
>
<ul class="itemize1">
<li class="itemize">siunitx example that doesn&#x2019;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>

• Thanks for such a rapid response. What are the system requirements for this to work. When I compile using the options: "xhtml,charset=utf-8" " -cunihtf -utf8" It fails at a step "Entering engbird.lg" If I remove the space before -cunihtf it compiles but places dummy symbols in place of the actual symbols. Currently running on MikTex. Your sample html code if I place in a unicode text file displays correctly. So it's currently just the compilation thats not working. – EngBIRD Jan 15 '15 at 0:32
• @EngBIRD Sorry, I can tell nothing about MiKTeX, except I'm sure it exists. But I'm sure you can run htlatex as you're used to. – egreg Jan 15 '15 at 0:42
• Thanks for your answer. Removing all arguments other than the file and htlatex do permit successful rendering of my document. I have yet to compile a document where these arguments actually did something. – EngBIRD Jan 15 '15 at 0:43
• For completeness - \RequirePackage{charter} doesn't seem to be compatible with the above solution. – EngBIRD Jan 15 '15 at 1:36
• @EngBIRD Probably the Charter font misses the degree symbol in the TS1 encoding. Why are you using \RequirePackage instead of \usepackage? – egreg Jan 15 '15 at 10:20