LaTeXML A LaTeX to XML/HTML/MathML Converter

Get LaTeXML

Quick Start

Current Release

The current release is 0.8.6 (tar.gz). (see the Change Log). Prebuilt packages sometimes lag behind the latest release.

Most people will want to install a prebuilt release, and some version of TeX. Choose the appropriate Operating system, repository type and context from the table below. This will install all necessary prerequisites, unless otherwise noted.

Platform Command Details
Linux
RPM-based sudo dnf install LaTeXML RPM-based
or sudo yum install LaTeXML
Debian sudo apt-get install latexml Debian
MacOS MacPorts
w/MacTeX sudo port install LaTeXML +mactex MacOS (MacTeX preinstalled)
w/TeXlive sudo port install texlive-latex sudo port install LaTeXML MacOS
w/o TeX sudo port install LaTeXML MacOS
Windows
Chocolatey choco install latexml Chocalatey; may need TeX
Strawberry cpan LaTeXML Strawberry-Perl; may need TeX, ImageMagick
Any
CPAN cpan LaTeXML CPAN; may need TeX, ImageMagick, libxml2,libxslt

Note that there is no implied endorsement of any of these systems.

Development version or from Source

If you want to use the ‘bleeding edge’ development version with the latest patches and improvements, you may fetch the source from GitHub. (The same installation instructions apply if you are using source from a release tarball.)

Prerequisites

will need to be pre-installed (including any optional ones); see Prerequisites.

It may be expedient, when a prebuilt LaTeXML is available, to first simply install LaTeXML from your system’s repositories (See the commands below specific to your system). Then uninstall it (often by using the OS’ package manager with the remove sub-command instead of install); This generally leaves the prerequisites installed.

Clone

the development source from github:

git clone https://github.com/brucemiller/LaTeXML.git
cd LaTeXML

(Keep up-to-date by occasionally running git pull and rebuilding.)

Alternatively, a zip

can be downloaded from LaTeXML-master.zip, and unpacked:

unzip LaTeXML-master.zip
cd LaTeXML-master
or, a tarball

can be downloaded from 0.8.6 (tar.gz), and unpacked:

tar zxvf LaTeXML-0.8.6.tar.gz
cd LaTeXML-0.8.6

Build

LaTeXML in its source directory using the standard Perl procedure (On Windows, use dmake instead of make):

perl Makefile.PL
make
make test

The tests should complete without error (some tests may be ‘skipped’).

Append the following options to the perl Makefile.PL command, if desired:

PREFIX=perldir

specifies a nonstandard place to install LaTeXML

TEXMF=texdidr

specifies a where to install LaTeXML’s TeX style files.

(See perl perlmodinstall for more details and options.)

Install

LaTeXML to where the OS can find the files

sudo make install

(Alternatively, you can run directly from the build directory, eg. latexmldir/blib/script/latexml.)

Prerequisites

LaTeXML requires several Perl modules to do its job. Most are automatically installed by the platform-specific installation or CPAN. However, CPAN will not install the required C libraries needed for XML::LibXML, and XML::LibXSLT. If libxml2 and libxslt are are not already installed, follow the instructions at XMLSoft to download and install the most recent versions of libxml2 and libxslt. Note that Strawberry Perl, on Windows, already includes these libraries (but ActiveState does not).

Recommend

to install prerequisites from prebuilt packages for your system, if available, rather than from scratch.

Optional Prerequisites

will be wanted by most users, but are not required because they are sometimes difficult to find or install, or to allow for minimal installs.

TeX

Virtually all users of LaTeXML will want to install TeX. LaTeXML should find whatever TeX-installation you have, and will use TeX’s style files directly in some cases, providing broader coverage, particularly for the more complex styles like babel and tikz. Moreover, if TeX is present when LaTeXML is being installed, LaTeXML will install a couple of its own style files that can be used with regular TeX, or LaTeX runs; So if you are going to install TeX, install it first! See TeX Users Group for more options.

Note that LaTeXML will use, for its own purposes, the style files from whatever TeX system, if any, it finds at runtime.

Image::Magick

provides a handy library of image manipulation routines. When they are present LaTeXML is able to carry out more image processing, such as transformations by the graphicx package, and conversion of math to images; otherwise, some such operations will not be supported.

See ImageMagick Issues for installation and usage issues.

Graphics::Magick

is an alternative to Image::Magick that LaTeXML will use if is found on the system; it may (or may not ) be easier to install, although it is less widely available.

UUID::Tiny

generates unique identifiers that can be used to make better ePub documents (it can be installed using CPAN).

perl-doc

On some compact distributions the perl documentation modules are not installed by default (eg. debian minimal). These modules help generate readable command-line documentation for the LaTeXML tools. Thus you may want to install an extra package (perl-doc on debian minimal) to enable this feature.

Note to packagers: If you are preparing a compiled installation package (such as rpm or deb) for LaTeXML, and the above packages are easily installable in your distribution, you probably should include them as dependencies of LaTeXML.

Linux systems

RPM-based systems

Current (or recent) releases of LaTeXML should be available from the Fedora (and probably others including Redhat Enterprise Linux, CentOS, Scientific Linux…) repositories (Thanks Mike Petullo).

Install prebuilt

LaTeXML, including all prerequisites including texlive for TeX with:

sudo dnf install LaTeXML

(use yum instead dnf, on some systems):

Install only prerequisites

(including the optional ones) with:

sudo dnf install \
  perl-Archive-Zip perl-DB_File perl-File-Which \
  perl-Getopt-Long perl-Image-Size perl-IO-String perl-JSON-XS \
  perl-libwww-perl perl-Parse-RecDescent perl-Pod-Parser \
  perl-Text-Unidecode perl-Test-Simple perl-Time-HiRes perl-URI \
  perl-XML-LibXML perl-XML-LibXSLT \
  perl-UUID-Tiny texlive ImageMagick ImageMagick-perl

(use yum instead dnf, on some systems):

Debian-based systems

For Debian-based systems (including Ubuntu), the deb repositories are generally used for software installation. LaTeXML is available from Debian’s unstable repositories (the version in the stable repositories may be quite old) (Thanks Peter Ralph and Atsuhito Kohda).

Install prebuilt

LaTeXML, including its required and optional prerequisites including TeX, with:

sudo apt-get install latexml

Install only prerequisites

(including optional ones) with:

sudo apt-get install   \
  libarchive-zip-perl libfile-which-perl libimage-size-perl  \
  libio-string-perl libjson-xs-perl libtext-unidecode-perl \
  libparse-recdescent-perl liburi-perl libuuid-tiny-perl libwww-perl \
  libxml2 libxml-libxml-perl libxslt1.1 libxml-libxslt-perl  \
  texlive-latex-base imagemagick libimage-magick-perl

See note Optional Prerequisites about optional installation of perl-doc.

Archlinux & friends

For Archlinux and derivatives, it is most convenient to install from sources via CPANM. Nonetheless, a package can be found in the Archlinux User Repository. Furthermore, most dependencies can be found in the official repositories.

Install from AUR

(Arch User Repositories) using the perl-latexml package.

Install only prerequisites,

with:

sudo pacman -S db imagemagick perl perl-algorithm-diff \
   perl-archive-zip perl-file-which perl-image-size \
   perl-io-string perl-libwww perl-json-xs \
   perl-parse-recdescent perl-xml-libxml perl-xml-libxslt \
   texlive-core

Additionally, install the perl-text-unidecode community package.

MacOS

MacPorts

For Apple Macintosh systems, the MacPorts repository is perhaps the most convenient way to install LaTeXML; (Thanks devens, Mojca, Sean and Andrew Fernandes). Download and install MacPorts from that site. Since some users prefer MacTeX and don’t want a duplicate (large) texlive, and others prefer texlive, there are several ways to install LaTeXML\̇par

Install using MacTeX

(already installed), including prerequisites with:

sudo port install LaTeXML +mactex

Install with TeXLive

and other prerequisites with:

sudo port install texlive-latex
sudo port install LaTeXML

You may want to select a more complete TeXpackage than texlive-latex.

Install without TeX

using

sudo port install LaTeXML

Install only prerequisites

(including optional ones except TeX) with:

sudo port install \
  p5-archive-zip p5-file-which p5-getopt-long p5-image-size \
  p5-io-string p5-json-xs p5-text-unidecode p5-libwww-perl \
  p5-parse-recdescent p5-time-hires p5-uri p5-xml-libxml \
  p5-xml-libxslt p5-perlmagick

Windows

As with MacOS, there is no single TeX package that we can assume you’ll want to use, so we include no dependency in the following. You’ll probably want to preinstall a version of your choice; MikTeX is popular.

Windows using Chocolatey

Install Chocolatey prebuilt

LaTeXML as well as all prerequisites (including ImageMagick)(Thanks Ronald Tse), using:

choco install latexml

Windows using Strawberry Perl

Strawberry Perl, comes with many of our prerequisites pre-installed, and provides other needed commands (perl, cpan, dmake).

Install under Strawberry

from CPAN, after installing the TeX-system of your choice (if desired), and ImageMagick (see Installing ImageMagick under Windows), using:

cpan LaTeXML

Installing the optional package Image::Magick on Windows seems to be problematic, so we have omitted it from these instructions. You may want to try ImageMagick, but you’re on your own, there! You may have better luck with Graphics::Magick.

Installi only prerequisites under Strawberry,

except for TeX, and ImageMagick (see Installing ImageMagick under Windows), using:

cpan Image::Size Parse::RecDescent UUID::Tiny

Failing Installation with MiKTeX and administrative rights

Note that when trying to install with administrative rights rights on Windows, a MikTeX warning sometimes causes a test to fail with an error “kpsewhich: warning: running with administrator privileges”. This warning is something LaTeXML has no control over, and is specific to the MikTeX toolchain. To workaround the problem, you can set the LATEXML_KPSEWHICH_MIKTEX_ADMIN and LATEXML_TEST_TEXLIVE environment variables and try to force an installation.

Using Chocolatey

$Env:LATEXML_KPSEWHICH_MIKTEX_ADMIN=true ; $Env:LATEXML_TEST_TEXLIVE="0"; choco install latexml

Using CPAN

$Env:LATEXML_KPSEWHICH_MIKTEX_ADMIN=true ; $Env:LATEXML_TEST_TEXLIVE="0"; cpan latexml

CPAN installation

The following command will install LaTeXML and its Perl prerequisites, but you may need to pre-install libxml2 and libxslt (See Prerequisites), as well as optionally TeX  ImageMagick, if desired.

cpan LaTeXML

Install only prerequisites

(excluding libxml2, libxslt, TeX, ImageMagick) using:

cpan Archive::Zip DB_File File::Which Getopt::Long Image::Size \
  IO::String JSON::XS LWP MIME::Base64 Parse::RecDescent \
  Pod::Parser Text::Unidecode Test::More URI \
  XML::LibXML XML::LibXSLT UUID::Tiny

CPANM Installation

On certain linux machines, you may not want to install LaTeXML (or its dependencies) system-wide, or you may simply lack the required root rights to do so. In such a case, it is convenient to install the development version and dependencies into the home directory using a tool called cpanminus.

Bootstrap cpanminus,

if you haven’t previously, with the following commands

# Download and install cpanminus
curl -L https://cpanmin.us | perl - App::cpanminus
# Setup a directory in ~/perl5 to contain all perl dependencies
~/perl5/bin/cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

Install prerequisites

(excluding libxml2, libxslt, TeX, ImageMagick) using:

cpanm git://github.com/brucemiller/LaTeXML.git

This automatically fetches the latest version from GitHub and installs missing dependencies.

ImageMagick Issues

Although ImageMagick is a useful and powerful tool, it often presents installation and usage challenges, particularly its Perl binding and when used in conjunction with Ghostscript.

ImageMagick Versions

for the ImageMagick binaries and the Perl binding must match; often those available from CPAN are out-of-sync. Ideally, you should install the current versions of both ImageMagick and the perl binding from your OS/platform distribution, if available. Next best solution is to get the same versions from the same source following the instructions at ImageMagick to download and install the latest version of ImageMagick being sure to enable and build the Perl binding along with it.

Installing ImageMagick under Windows

seems to work best by downloading and installing the main ImageMagick binary appropriate for your Windows system from ImageMagick. Then fetch the PerlMagick tarball with the same version from ImageMagick/perl. Use the following commands to compile and install the PerlMagick, with X.XX being the version you downloaded:

tar -zxvf PerlMagick-X.XX.tar.gz
cd PerlMagick-X.XX
perl Makefile.PL
dmake
dmake test
dmake install

ImageMagick Security

is also an issue, due to the possibility of embadding malicious code in postscript, pdf and other image formats. For a certain range of versions of ImageMagick and Ghostscript, a security policy was set which inhibited processing of pdf files; the problem appears to be fixed recent versions. If you see operation not allowed by the security policy, see the discussion at stackoverflow.

Archived Releases: