[][src]Crate tectonic

Tectonic is a complete TeX/LaTeX engine converted into a standalone library. It is derived from the XeTeX variant of TeX and uses the support files packages by the TeX Live project. Tectonic would not be possible without the hard work that has gone into these projects.

Because Tectonic is based on the XeTeX engine, it can take advantage of the features of modern fonts (TrueType, OpenType, etc.), outputs directly to the PDF file format, and supports Unicode inputs. Tectonic differs from other TeX engines in the following ways:

  • Dependencies on environment variables and configuration files have been eliminated.
  • All I/O is routed through pluggable backends. Support data can be fetched from a single “bundle” file, and the engine’s (copious) output can be hidden or postprocessed.
  • The command-line frontend, tectonic, has a modernized user interface that never asks for user input.
  • The frontend is just a thin shim over the Tectonic Rust crate, so that the full engine can be embedded anywhere you can run Rust code.

The main module of this crate provides an all-in-wonder function for compiling LaTeX code to a PDF:

extern crate tectonic;

let latex = r#"
Hello, world!

let pdf_data: Vec<u8> = tectonic::latex_to_pdf(latex).expect("processing failed");
println!("Output PDF size is {} bytes", pdf_data.len());

The driver module provides a high-level interface for driving the engines in more realistic circumstances.


pub use engines::bibtex::BibtexEngine;
pub use engines::spx2html::Spx2HtmlEngine;
pub use engines::tex::TexEngine;
pub use engines::tex::TexResult;
pub use engines::xdvipdfmx::XdvipdfmxEngine;
pub use errors::Error;
pub use errors::ErrorKind;
pub use errors::Result;



User configuration settings for the Tectonic engine.


Helpers to tidy up the computation of digests in various places.


This module contains the high-level interface that ties together the various engines. The main struct is [ProcessingSession], which knows how to run (and re-run if necessary) the various engines in the right order.


Access to Tectonic’s processing backends.


Tectonic error types and support code.


Tectonic’s pluggable I/O backend.


A framework for showing status messages to the user.



“Chained try” — like try!, but with the ability to add context to the error message.


Use string formatting to create an Error of kind errors::ErrorKind::Msg.


Report a formatted error message to the user.


Show formatted text to the user, styled as an error message.


Report a formatted informational message to the user.


Report a formatted warning message to the user.



Compile LaTeX text to a PDF.