2.4 Making your .tex compatible with BookML
BookML uses LaTeX ML. While there is no guaruntee that every LaTeX ML copmatible .tex file will produce a good output, we refer to documentation for LaTeX ML for any issues not covered in this document.
2.4.1 Necassary pre-amble and style guide
For BookML to output correctly, the following preamble needs to be present.
\usepackage[british]{babel}
This uses the package babel, which allows the HTML output to programatically determine the language of the page. This is necesary for screen readers to interpret HTML.
\title{MATHXXX Lecture Notes}
\author{Firstname Lastname}
It is important to declare title and author so that the meta-data of the HTML file is correct.
\usepackage{bookml/bookml} % if not already in your preamble
\bmlAltFormat{lecturenotes.LARGE.pdf}{PDF (large print)}
{\bf some bold text} % DO
\bf some bold text % DON’T
\textbf{some bold text} % BEST
BookML works best when you use LaTeX commands (i.e. /textbf{}, /textit{}, …), rather than TeX commands (i.e. /bf, /it, …).
2.4.2 LaTeX Packages and BookML
BookML runs on LaTeX ML. Currently, LaTeX ML does not have support for every package. For a full list of supported packages, see this webpage.
If you use a package that is not on this list, there are a few fixes.
Custom packages
If you use a custom package in place of a pre-amble, change the extension to .tex, and use \input instead of \usepackage.
Packages for generating images
To use an image generation package, it is advised to use the command \bmlImageEnvironment.
\bmlImageEnvironment{environment type here}
\iflatexml
\else
\usepackage{image generation package}
% ... ALL of the package-related preamble code here
\fi
% No package commands after this point!
Now these environments will compile using the packages outlined. For more details, see the documentation.
Packages specific to the .pdf output
If a package is specific to the pdf output, use code in your pre-amble to the following:
\if latexml
% Write something that does similar to the package for html, or nothing at all.
\else
\usepackage{...} %Reference your package here
\fi
Unsupported classes
If a document class is not supported by LaTeXML, use the following code:
\iflatexml
\documentclass{...}
\else
\documentclass{...}
\fi
Other packages
If there is a similar package in the list supported by LaTeXML, it is recommended to use that package in its place. For simple packages, it may be possible to include pre-amble (or an imported .tex file) with similar functionality to the unsupported package.