Sometimes it is interesting to have equations in an e-book. Of course if it is a book on mathematics, but also in other books. I made an attempt to include equations in the book Into Programming, like this.

For the web version of the book, I used MathJax, a Javascript libary that allows you to write the equations using LaTex notation. As an example, the following html code

$$

a_n = a \prod_{i = 1}^n \left (1 + \frac{p_i}{100} \right )

\quad \quad \quad (5)

$$

can be used (together with the appropriate script tag to include MathJax) to create an equation. You can see the equation as equation number 5 on the About page for equations in the book Into Programming.

For the epub- and mobi-versions of the book I used images. I did not expect the typical e-book reader software of today to handle MathJax yet. The images are created from LaTeX, using a similar notation as for the MathJax, and each equation is put into its own LaTeX file, e.g like this

\documentclass[b5paper, 9pt]{memoir}

\usepackage{amsmath}

\pagestyle{empty}

\begin{document}

\begin{displaymath}

a_n = a \prod_{i = 1}^n \left (1 + \frac{p_i}{100} \right )

\quad (5)

\end{displaymath}

\end{document}

Then, images can be created, one for each equation, using LaTex and the tool dvipng.

You can see the result, in the e-books, in the Chapter called *Again and Again*. The books are found, as epub and mobi, on the Books page.

### Like this:

Like Loading...

*Related*