I try to use TeX4ht and Calibre to create an ebook that I can read with an iPad.
I use the following command: htlatex file.tex "xhtml, jsmath""-cmozhtf"
.
The result with Calibre is correct except for some mathematical formulas.
For example, the equation : $ x ^ 2 - 6x +6 = 0$
, we obtain : {x} ^ {2} - 6x + 6 = 0
.
To : \ [B (x) =-x ^ 2 + 60x-500, \ quad \ textrm {where $ x $ belongs to the interval $ \ left [0 \, 60 \ right] $.} \]
we obtain : B (x) = - {x} ^ {2} + 60x - 500, \ quad \ textrm {where $ x $ belongs to the interval $ \ left [0 \ kern 1.81503pt, 60 \ right] $ .}
For : $ T_1 $
, we obtain : {T} _ {1}
.
First question :
Why, in this code, formulas framed dollars are not transformed into images (and the record is best !)?
\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts}
\begin{document}
\section*{Sample French Text}
Lucie, étudiante des États-Unis, vient d'arriver à Charles de
Gaulle, l'aéroport qui accueille chaque jour à Paris, 1 million de
visiteurs. Paris. Enfin. Ça a toujours été le rêve de Lucie : vivre
dans la Ville lumière, la ville des beaux arts, du quartier latin, du
vin, et qui sait, peut-être la ville d'une petite histoire d'amour.
\section*{Math Part}
Numbered equation:
\begin{equation}
P_{r-j}=
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases}
\end{equation}
Un-numbered equation:
\begin{equation*}
P_{r-j}=
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases}
\end{equation*}
Inline equation:
$ x ^ 2 - 6x +6 = 0$ and $B (x) =-x ^ 2 + 60x-500, \quad
\textrm{where $ x $ belongs to the interval $ [0 \, ; 60 ] $.}$
Eqnarray
\begin{eqnarray}
P_{r-j}&=&
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases} \\
P_{r-j}&=&
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases}
\end{eqnarray}
Starred eqnarray
\begin{eqnarray*}
P_{r-j}&=&
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases} \\
P_{r-j}&=&
\begin{cases}
0 & \text{si $r-j$ est impair,} \\
r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.}
\end{cases}
\end{eqnarray*}
\end{document}
Second question : I followed the method described in the link, and the pictures are better but in my opinion, too small. How to resize images ?
Third question : I tried to put the images in svg format, but it does not work:
Erreur d'analyse XML : mal formé
Emplacement : file:///home/fab/der1x.svg
Numéro de ligne 1, Colonne 2 :
%!PS-Adobe-3.0
-^
Here are the contents of tex4ht.env modified and the file contents myconfig.cfg :
<dvipng>
G.png
Gdvipng -T tight -x 1400 -D 72 -bg Transparent -pp %%2:%%2 %%1 -o %%3
G.gif
Gdvipng -T tight -x 1400 -D 72 -bg Transparent -gif -pp %%2:%%2 %%1 -o %%3
G.
Gdvips -Ppdf -mode ibmvga -D 110 -f %%1 -pp %%2 > zz%%4.ps
Gconvert -crop 0x0 -density 110x110 -transparent '#FFFFFF' zz%%4.ps %%3
Grm zz%%4.ps
G.svg
Gdvisvgm -n -p %%2 -c 1.2,1.2 -s %%1 > %%3
</dvipng
\Preamble{xhtml}
\Configure{Picture}{.svg}
\begin{document}
\EndPreamble
Fourth question : use MathJax with TeX4ht gives a very good result in the test.html that the iPad opens without problems, but if you use Calibre to get an ebook, the result is very bad ! The only small problem is that with this little script accented characters are replaced by question marks :
#!/bin/bash
if [ $1 ]
then
NAME=`echo $1 | sed 's/.tex//g'`
htlatex $1 "ht5mjlatex.cfg" "-cmozhtf"
iceweasel $NAME.html;
exit
fi
It will be difficult to make an ebook using TeX4ht. I tried to install TeX4ebook, but there is an installation problem :
fab@debian:~$ texlua /home/fab/texmf/tex/latex/tex4ebook-master /tex4ebook.lua
/home/fab/texmf/tex/latex/tex4ebook-master/tex4ebook.lua:113: invalid escape sequence near '\$'
{}
there but that is OK is it not? (jsmath is no longer really supported and is replaced by mathjax (by the same author)$ x ^ 2 -6 x+6 = 0$
, I want to get the output:x ² - 6x + 6 = 0
, and not:{x} ^ {2} - 6x + 6 = 0
If I understand, so I do:htlatex file.tex "xhtml, mathjax", "-cmozhtf"
.\documentclass{...} ... \end{document}
. It will help us to help you!\documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath,amsfonts} \usepackage[frenchb]{babel} \begin{document} \begin{equation} P_{r-j}= \begin{cases} 0 & \text{si $r-j$ est impair,} \ r! \, (-1)^{(r-j)/2} & \text{si $r-j$ est pair.} \end{cases} \end{equation} \end{document}
I compile with:htlatex file.tex "xhtml, mathjax", "-cmozhtf"
and I use Calibre to convert the html file into an epub file.The formula appears like in the source file !