#conversion #latex #html5 #mathml #cli

bin+lib latexml-runner

Rust runner for high-performance TeX to HTML conversions with latexml

7 releases

0.1.6 Mar 11, 2021
0.1.5 Mar 7, 2021
0.1.3 Feb 16, 2021
0.1.0 Dec 23, 2020

#11 in #mathml

Download history 4/week @ 2024-02-26 9/week @ 2024-03-11 119/week @ 2024-04-01

128 downloads per month

MIT license

80KB
682 lines

latexml-runner

Rust runner for high-performance conversions with latexmls.

Build Status License crates.io

This executable is useful over the native Perl executables of latexml if:

  • You have a large number of tasks with a shared set of TeX/LaTeX packages and preambles.
  • The tasks are small enough that latexml's overhead is a performance bottleneck (e.g. single formulas or abstracts/paragraphs).
  • Your system installation allows for a custom perl plugin
  • concretely latexmls v1.5.0, a socket server for LaTeXML.

If your conversion task requires a distributed setup and/or is unable to preload most dependencies, this crate won't offer you much of a speedup. For such cases, consider LaTeXML::Plugin::Cortex as one alternative.

Demo

You can try it out by using the publick docker image and avoid any installation headaches.

In the following example, we use an invocation useful for converting math in sites such as StackExchange and Wikipedia:

$ for i in {1..200}; do echo "\sqrt{x}+\frac{1}{2}=0" >> formula_latex.txt; done
 
$ time docker run --cpus="2.0" --memory="8g" \
-v "$(pwd)":/workdir -w /workdir \
latexml/latexml-runner:latest \
-i formula_latex.txt -o formula_xml.csv -l formula_status.log \
--preload=LaTeX.pool --preload=bm.sty --preload=texvc.sty \
--preload="literal:\\let\\theequation\\relax" \
--whatsin=math --whatsout=math --pmml --cmml --mathtex --format=html5 \
--nodefaultresources --timeout=30 

Should complete in e.g. 9.5 seconds on a Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz.

Importantly, the formula_status.log file should contain two hundred zeros, one on each line, to signal that the conversions are robustly finishing error-free. In other words, that the harness and latexmls are communicating correctly.

Dependencies

~6–17MB
~207K SLoC