Installing LaTeXML for Metanorma (and tex2mn)

Author’s picture Alex Bobrikovich Author’s picture Ronald Tse on 11 May 2020

Introduction

Metanorma’s processor for the StandardDocument model (aka metanorma-standoc) depends on the excellent LaTeXML package from NIST to process MathML fragments.

Typically, you will only need the latest stable version of LaTeXML to use Metanorma: version 0.8.4 as of today.

However, if you are using or plan on using TeX syntax input for Metanorma (i.e. tex2mn, see our previous post, Metanorma now supports LaTeX input), you will need the currently unreleased version of LaTeXML 0.8.5 for its additional features.

This post explains how to install the “edge” version of LaTeXML.

Note
Special thanks to Bruce Miller and Deyan Ginev for their unwavering support!

Installing the latest stable LaTeXML

Windows

The LaTeXML package is available on Chocolatey package manager and can be easily installed via the Chocolatey command-line interface.

choco install -y latexml

Linux

The LaTeXML snap is available on the Snap store and can be installed on Ubuntu and Linux platforms that are Snap-enabled.

sudo snap install latexml

MacOS

The LaTeXML formula is available from the Homebrew package manager.

brew install latexml

CPANM

If the latest stable LaTeXML version isn’t available from the package manager of your choice, you can always install it with cpanm:

# Download and install cpanminus
curl -L http://cpanmin.us | perl - App::cpanminus

cpanm LaTeXML

Installing pre-release LaTeXML

In order to utilize unreleased features, you may follow the instructions below to install pre-release versions of LaTeXML.

Windows

The following command installs the latest beta release of LaTeXML via Chocolatey.

choco install -y latexml.beta

Linux

The following command installs the latest “edge channel” release of LaTeXML via the Snap store.

sudo snap install latexml --edge

MacOS

There is currently no easy to install a pre-release version via Homebrew — use the CPANM method instead.

CPANM

If you have to use the specific dev version of LaTeXML it can be installed with cpanm.

Notice that CPAN is a prerequisite, and its installation methods differ per platform:

macOS:

brew install cpanminus

Windows:

choco install -y strawberryperl imagemagick.tool

Linux/Unix:

curl -L http://cpanmin.us | perl - App::cpanminus

Once CPAN is installed, the remaining command is to install LaTeXML via cpanm:

cpanm git://github.com/brucemiller/LaTeXML.git@9a0e7dc5

Troubleshooting

In most cases, problems occur with installation dependencies that depend on native libraries, such as:

  • XML::LibXSLT

  • XML::LibXML

The fix is to install the specific version of the dependency that correlates with the version of the native library installed on your machine.

This command on macOS, for example, ensures that XML::LibXSLT matches the version of libxml2 installed:

brew install libxml2 cpanminus
env PATH=$(brew --prefix libxml2)/bin:$PATH \
  cpanm --notest XML::LibXSLT@1.96 \
  git://github.com/brucemiller/LaTeXML.git@9a0e7dc5