1

i've read this question Choppy equations with tex4ht and currently im displaying math as png pictures with the mybuild.mk4 file

Make:image("png$","dvipng -bg Transparent -T tight -D151  -o     ${output}  -pp ${page} ${source}")
Make:image("svg$","dvisvgm -n -p ${page} -c 1.4,1.4 -s ${source} > ${output}")

and compiling with

tex4ebook -c config.cfg -f epub3 -e mybuild.mk4 "%N%T"

but apparently this setup only works for the equation command in latex, not for align. Here's an example:

top is align, bottom equation. The equations are not centered and the baselines seem to get messed up. Furthermore, if the equation gets too long, instead of a linebreak or downscaling the label disappears

MWE:

\documentclass{book}

\usepackage{mwe}
\usepackage{amsmath}


\begin{document}

\begin{align}
\varepsilon_{x}=\frac{1}{E}\cdot [\sigma_{x}-\upsilon \cdot(\sigma_{y} + \sigma_{z})] +1 +1 +1 +1 +1 +1 +1 +1
\end{align}

\begin{equation}
\varepsilon_{x}=\frac{1}{E}\cdot [\sigma_{x}-\upsilon \cdot(\sigma_{y} + \sigma_{z})]
\end{equation}

\end{document} 

Is there a way to make it work with align? Unfortunately i already have a lot of align environments in my latex file

2

You can convert the whole contents of align and equation environments to pictures. It is supported out of the box using pic-align option for align, for equation you must use simple configuration:

\Preamble{xhtml,pic-align}
\ConfigureEnv{equation}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="equation">}\Picture*{}}{\EndPicture\HCode{</div>}}{}{}
\Css{div.align,div.equation{text-align:right;}}
\begin{document}
\EndPreamble

This configuration will insert equation as a picture inside <div class="equation">. Css is then used to align both environments to the right.

This is a result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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