This week, I published my MSci thesis and some lecture notes on Leanpub. I wrote the first version of the MSci thesis in Microsoft Word in 1997. I converted it to LaTeX as an exercise. Most mathematicians use LaTeX, so it made sense to do this. I also needed to learn LaTeX to write my PhD. I wrote the lecture notes with LaTeX.

Leanpub is a great place to develop books. You can publish parts of the book as you go, or publish in one go. You don’t have to use markdown, but I prefer it. I keep my books in git repositories. Also markdown is plain text and as such is portable. It’s easy to edit with a simple text editor.

Leanpub has two versions of markdown for creating books. The latest is called Markua. It has extensions for references, contents, bibliographies and indices.

I converted my notes from LaTeX using scripts and with a bit of manual editing too. Claude kindly read the source code of pandoc and suggested what to do. Also please refer to the Markua Mathematics documentation.

Although the equation rendering is fully handled by Leanpub, I had to script the result and bibliography numbering myself. If you are interested in this, I can provide the scripts. Maybe I will clean them up and release them. The trick is to use tags like @ref@, replace the LaTeX labels and refs with them, and use a preprocessor on the text.

To use mathematics in a Leanpub book, make sure your Markdown Dialect is Markua 0.31. This is all I needed to know to convert my documents:

Formatting

You need to convert headings, italics and bold to markdown. So in LaTeX you have:

\chapter{Chapter}
\section{Section}
This is \emph{italics}. And this is \textbf{bold}.
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}

And in Markua you have:

# Chapter

## Section
This is *italics*. And this is **bold**.

1. Item
2. Item

Inline text

In LaTeX you would write:

Let $\Omega$ be a set.

In Leanpub you would write:

Let `\Omega`$ be a set.

You cannot split the equation over different lines like you can with LaTeX.

Here is a more complicated example.

LaTeX:

A subgroup $G$ of $\FSym(\Omega)$ is called a \emph{finitary
permutation group} on $\Omega$ and in this case,
$G$ has \emph{degree $|\Omega|$}.

Leanpub Markua:

A subgroup `G`$ of `\mathrm{FSym}(\Omega)`$ is called a
*finitary permutation group* on `\Omega`$ and in this case,
`G`$ has *degree* `|\Omega|`$.

Big equations

In LaTeX you would write:

The \emph{finitary general skew linear group} on $V$ is
$$\mathrm{FGL}(V)=\left\{g\in\mathrm{GL}(V): \mathrm{dim}_D[V,g] < \infty \right\}.$$

In Leanpub, you would write:

The *finitary general skew linear group* on `V`$ is

```$
\mathrm{FGL}(V)=\left\{g\in\mathrm{GL}(V): \mathrm{dim}_D[V,g] < \infty \right\}.
```

The backticks must be on their own lines with no exceptions.

Big aligned equations

If you want to do alignment of symbols (like =) in formulae, you can do it in the backtick format.

In Leanpub, you can use ampersands (&) to align characters in the same way you can with LaTeX:

```$
\begin{aligned}
\frac{H}{C_H(Y/Y^{rs})} = \frac{H}{(H\cap Y)C_H(Y/Y^{rs})} & = & \frac{H}{H\cap YC_H(Y/Y^{rs})}\\
& \cong & \frac{YH}{YC_H(Y/Y^{rs})}\\
& = & \frac{K}{YC_H(Y/Y^{rs})}
\end{aligned}
```