A Ruby wrapper for the LaTeXML LaTeX to XML/HTML/ePub converter.
Includes support for daemonized conversion runs, for additional performance, via the latexmls socket server.
You may be familiar with other LaTeX conversion tools such as Pandoc or tex4ht. LaTeXML attempts to be a complete TeX interpreter, and covers a vastly larger range of the TeX/LaTeX ecosystem than Pandoc. At the same time it allows for just-in-time binding of structural and semantic macros, which allows it to create higher quality HTML5 than tex4ht, and makes bridging the impedance mismatch between PDF and HTML an achievable goal.
Install the stand-alone LaTeXML application using your preferred method
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install latexml-ruby
The current default setup of the wrapper options uses some advanced LaTeX packages, for which you also need a working LaTeX installation on the machine, as LaTeXML resorts to the native LaTeX definitions. It's usually best to install
texlive, or a similar comprehensive TeX distro. For a minimal setup set of options, see the basic test setup
A hello world conversion job looks like:
require 'latexml' @latexml = LaTeXML.new response = @latexml.convert(literal: "hello world") result = response[:result] messages = response[:messages] status_code = response[:status_code]
You can find more information on the LaTeXML message codes in the official manual.Status codes range from 0 (OK), 1 (warning), 2 (error) to 3 (fatal error).
Bug reports and pull requests are welcome on GitHub at https://github.com/Authorea/latexml-ruby.
The 0.0.1 release of the wrapper brings support for easy conversion of latex fragments, which only scratches the surface of LaTeXML's versatile conversion use cases. If you are interested in a different workflow that is not yet supported, we will be very happy to hear from you.
The gem is available as open source under the terms of the MIT License.