A converter that transforms TeX and LaTeX into XML/HTML/MathML


    use LaTeXML;
    my $converter = LaTeXML->get_converter($config);
    my $converter = LaTeXML->new($config);
    $converter->initialize_session; # SHOULD BE INTERNAL
    $hashref = $converter->convert($tex);
    my ($result,$log,$status)
         = map {$hashref->{$_}} qw(result log status);


LaTeXML is a converter that transforms TeX and LaTeX into XML/HTML/MathML and other formats.

A LaTeXML object represents a converter instance and can convert files on demand, until dismissed.


my $converter = LaTeXML->new($config);

Creates a new converter object for a given LaTeXML::Common::Config object, $config.

my $converter = LaTeXML->get_converter($config);

Either creates, or looks up a cached converter for the $config configuration object.


Top-level preparation routine that prepares both a correct options object and an initialized LaTeXML object, using the ”initialize_options” and ”initialize_session” routines, when needed.

Contains optimization checks that skip initializations unless necessary.

Also adds support for partial option specifications during daemon runtime, falling back on the option defaults given when converter object was created.

my ($result,$status,$log) = $converter->convert($tex);

Converts a TeX input string $tex into the LaTeXML::Core::Document object $result.

Supplies detailed information of the conversion log ($log), as well as a brief conversion status summary ($status).



Given an options hash reference $opts, initializes a session by creating a new LaTeXML object with initialized state and loading a daemonized preamble (if any).

Sets the ”ready” flag to true, making a subsequent ”convert” call immediately possible.

my $latexml = new_latexml($opts);

Creates a new LaTeXML object and initializes its state.

my $postdoc = $converter->convert_post($dom);

Post-processes a LaTeXML::Core::Document object $dom into a final format, based on the preferences specified in $$self{opts}.

Typically used only internally by convert.


Binds STDERR to a ”log” field in the $converter object

my $log = $converter->flush_log;

Flushes out the accumulated conversion log into $log, resetting STDERR to its usual stream.