# Using \widehat in tex4ebook fails

In the generated epub file, the hat is invisible.

The MWE is:

\documentclass{amsbook}
\begin{document}
$\widehat{t_0}$
\end{document}


This compiles under plain LaTeX, without any problems, and shows a t0 with a hat on top, as expected.

When compiled using the command

tex4ebook -f epub3 test


there are no error messages, but the output is a t0 without a hat on top. When I look at the test.dvi that was produced by this command, there is a t0 with the text en-USxx, left-aligned on top of the t0.

I thought perhaps it might have to do with some character encoding magic, so I added the lines

\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}


in the preamble. This changed the dvi output to simply xx rather than en-USxx on top of the t0.

PS: Other variations:

• I tried with a plain $\widehat{y}$ with similar results.
• I tried a simple \hat with similar results.

Some math features are not available in the default HTML output from TeX4ht. You have two basic options for math inEpub 3 output: MathML and images.

MathML is in general preferable to images, as the conversion is faster and the quality of the output is better. The problem is that not all Epub 3 readers really support it. It is usually good in desktop apps like Calibre, on Android, etc., but for example e-ink devices tend to be bad. Especially the older ones.

Anyway, you can try it:

 tex4ebook -f epub3 test "mathml"


This is how it looks in Calibre:

For pictures, try:

 tex4ebook -f epub3 test "pic-m,svg"
`

It will create SVG image for every inline math environment. The compilation will take longer time and it will look worse in most cases, but it is more portable and it should work in every reader.

• The "mathml" worked, the "pic-m,svg" was incredibly slow and made a huge file. I finally decided that pdf was much better looking even if it didn't have reflow and had a fixed page size. Oct 22 '20 at 21:32