Installing LaTeXML for Metanorma (and tex2mn)
There are many ways to install LaTeXML depending on your needs
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.
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 latexmlLinux
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 latexmlMacOS
The LaTeXML formula is available from the Homebrew package manager.
brew install latexmlCPANM
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 LaTeXMLInstalling 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.betaLinux
The following command installs the latest “edge channel” release of LaTeXML via the Snap store.
sudo snap install latexml --edgeMacOS
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 cpanminusWindows:
choco install -y strawberryperl imagemagick.toolLinux/Unix:
curl -L http://cpanmin.us | perl - App::cpanminusOnce CPAN is installed, the remaining command is to install LaTeXML via cpanm:
cpanm git://github.com/brucemiller/LaTeXML.git@9a0e7dc5Troubleshooting
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=<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>b</mi><mi>r</mi><mi>e</mi><mi>w</mi><mo>−</mo><mo>−</mo><mi>p</mi><mi>r</mi><mi>e</mi><mi>f</mi><mi>i</mi><mi>x</mi><mi>l</mi><mi>i</mi><mi>b</mi><mi>x</mi><mi>m</mi><mi>l</mi><mn>2</mn><mo stretchy="false">)</mo><mi mathvariant="normal">/</mi><mi>b</mi><mi>i</mi><mi>n</mi><mo>:</mo></mrow><annotation encoding="application/x-tex">(brew --prefix libxml2)/bin:</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">e</span><span class="mord mathnormal" style="margin-right:0.0269em;">w</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">−</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">e</span><span class="mord mathnormal" style="margin-right:0.1076em;">f</span><span class="mord mathnormal">i</span><span class="mord mathnormal">x</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">ib</span><span class="mord mathnormal">x</span><span class="mord mathnormal">m</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord">2</span><span class="mclose">)</span><span class="mord">/</span><span class="mord mathnormal">bin</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span></span></span></span>PATH \
cpanm --notest XML::LibXSLT@1.96 \
git://github.com/brucemiller/LaTeXML.git@9a0e7dc5