---
name: "LaTeXML"
section: "3pm"
platform: "linux"
package: "latexml"
version: "0.8.8-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/LaTeXML"
---

# LaTeXML(3pm)

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

## NAME

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

## SYNOPSIS

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

## DESCRIPTION

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.

### METHODS

- "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.

- "$converter-\>prepare\_session($opts);"

  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).

### INTERNAL ROUTINES

- "$converter-\>initialize\_session($opts);"

  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"`.

- "$converter-\>bind\_log;"

  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.

## AUTHOR

Bruce Miller \<bruce.miller@nist.gov\> Deyan Ginev \<deyan.ginev@nist.gov\>

## COPYRIGHT

Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US. You may consider this as released under the CC0 License.
