To export many mathematical articles and surveys to Kindle from the LaTeX source code, I am trying to use tex4ebook. It seems to me that I still need to hack many LaTeX codes to finish the compilation, especially I found a case, which is pretty common in LaTeX codes but not compatible with tex4ht (I think): calligraphic letters in subscripts like _\mathfrak m or ^\mathcal T in math mode. A sample code is:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
Given a topological space $X$ with a circle $\mathbb T$-action, let's look at the space of fixed points $X^\mathbb T$.
\end{document}

When running tex4ebook, it indicates an error at ^\mathbb during compilation, while no error is shown during the ordinary LaTeX compilation. I want to ask the reason for that, and suggestions for better practice. Thanks!

  • 5
    Syntax like _\mathbb A or ^\mathbb{B}, only works by accident. So advising users to use _{\mathbb{A}} is the right call. – daleif Nov 9 at 12:58
  • 2
    I'm always amazed that x_\mathbb{A} crops up (but it does crop up all the time), how do people even notice that "works" and start using it. No normal tex command parses its arguments in that way, try \frac\mathbb{A}\mathbb{B} It is a peculiarity of the primitive ^ and _ parsing (which is why it doesn't work in tex4ht which needs to define _ and ^ as macros to add additional processing) – David Carlisle Nov 9 at 13:29
  • @DavidCarlisle I cannot tell about others, but I believe that we usually start to learn LaTeX, as a tool, by practice, or a mixture of practice and manuals, without thoroughly understanding the syntax. The other point seems to be a relatively loose syntactical (or convenient) structure of TeX, in comparison to, say, the Lisp language (inconvenient). – Frank Science Nov 9 at 14:00
up vote 3 down vote accepted

You definitely should use X^{\mathbb{T}}$, the syntax you use, while it works with LaTeX, cannot be supported by tex4ht configurations. The only way to support it to convert math to pictures. Which doesn't look nice, but it preserves the original appearance of math. It may work on Kindle (but not really well).

The pictures for inline math can be requested using pic-m option for tex4ht. It can be used in tex4ebook in the following way:

tex4ebook -f mobi filename.tex "pic-m"

With this option, I don't get error with your sample. The output looks like this in the browser:

enter image description here

Compare it with normal math:

enter image description here

You need to test it on actual Kindle, because I am not sure about it's support for math characters in text, or how the math pictures will look with the default Kindle font.

  • Thank you for your answer and an additional remark about pic-m. Kindle doesn't work well for math pictures, as they are shown significantly smaller than the text. It seems to me that I can only use kindle to read articles non-seriously. The only good solution should be MathML, claimed to be supported in the future. – Frank Science Nov 9 at 17:53
  • @FrankScience if Kindles get MathML support, it would fix all issues. Meanwhile, you can change the resolution of the math pictures in the .mk4 build file, see the image conversion section. You can also try the SVG pictures using svg option along with pic-m. – michal.h21 Nov 9 at 20:51
  • Thanks. For svg option, are you referring to one of your answer? I don't know whether changing the resolution will work. The DPI of my kindle is 167ppi (the cheapest one), which seems to be the default setting in tex4ebook? – Frank Science Nov 10 at 13:17
  • @FrankScience dvisvgm can scale images, so the siza can match the text and the quality should be better than with png images. – michal.h21 Nov 10 at 20:06

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.