latexml-runner

Crates.iolatexml-runner
lib.rslatexml-runner
version0.1.6
sourcesrc
created_at2020-12-23 19:02:10.034223
updated_at2021-03-11 21:34:56.692906
descriptionRust runner for high-performance TeX to HTML conversions with latexml
homepagehttps://github.com/dginev/latexml-runner
repositoryhttps://github.com/dginev/latexml-runner
max_upload_size
id326652
size17,371,216
Deyan Ginev (dginev)

documentation

README

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.

Commit count: 46

cargo fmt