Skip to content

dginev/LaTeXML-Plugin-latexmls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaTeXML::Plugin::latexmls

Build Status license CPAN version

A minimal socket server for daemonized LaTeXML processing

Installation

Just another Perl module. Use either the modern cpanm . or the classic:

perl Makefile.PL ; make ; make test; sudo make install

Make sure that LaTeXML has been installed prior to installing this Plugin, as well as all modules reported missing by Makefile.PL.

Example use

See the casual author use pattern by the latexmlc executable of LaTeXML.

On a generic level, latexmls takes an HTTP request and returns a JSON payload. This can be illustrated with a minimal curl example:

  1. Start a server process on some available port, and specify the allowed inactivity before it automatically shuts down.

    latexmls --port=43434 --expire=60
  2. Initialize a new cached conversion profile, using the cache_key capability with a mock conversion call. Specify all configuration you would typically provide for latexml/latexmlpost here.

    curl http://localhost:43434 -o payload.json -d \
    'cache_key=eg&preload=article.cls&preload=texvc.sty&whatsin=math&whatsout=math&format=html5&source=literal:1'
  3. Use the cached profile for real conversions.

    curl http://localhost:43434 -o payload.json -d 'cache_key=eg&source=literal:\sqrt{x}>0'

    Note that latexmls expects proper url encoding if you're assembling your HTTP requests by hand, e.g. \sqrt{x} needs to be transmitted as %5Csqrt%7Bx%7D. This is done automatically by the curl -d flag in the example above.

  4. The returned json payload (indented for readability here) for this configuration should look along the lines of:

    {
      "status": "No obvious problems",
      "log": "...Status:conversion: 0 ",
      "status_code": 0,
      "result": "<math ...</math>"
    }

Known current uses of latexmls

Alternatives

See also the ltxmojo web showcase which uses a proper web service framework, as a potential alternative or inspiration for bundling LaTeXML into your web framework of choice.

Security Warning

While latexmls has been used in production settings, it is not secure standalone. At a minimum, known vulnerabilities in TeX-related I/O should be patched, e.g. using the secureio plugin for latexml.