RusTeX

A library to make simple auto-generated LaTeX files in Rust.

Quick start

To use RusTeX, add the crate to your Cargo.toml.

toml [dependencies] rustex = "0.1.0"

Documentation

The documentation is accessible here.

Implemented Features

Components

Formatting

Example

A full example with the resulting PDF file is accessible in the example folder.

  1. Start by creating a base Document

    ```rust const DOCUMENTNAME: &str = "generatedtex/main.tex"; const DOCUMENTCLASS: ClassType = ClassType::Report; const FONTSIZE: &str = "12pt";

    let docfile: File = File::create(DOCUMENTNAME).unwrap();

    let docclass: DocumentClass = DocumentClass::new( DOCUMENTCLASS, vec![FONT_SIZE] );

    let mut doc: Document = Document::new(docfile, docclass); ```

  2. Add some Packages

    ```rust let packages = vec![ Package::new( "babel", vec!["english"] ), Package::new( "geometry", vec!["margin=2.5cm"] ), Package::new( "fontenc", vec!["T1"] ) ];

    doc.add_packages(packages); ```

  3. Add some global Commands

    ```rust let commands = vec![ Command::new(r"\title{Title}"), Command::new(r"\author{Author}"), Command::new(r"\date{YYYY / MM / DD}"), Command::new(r"\setlength{\tabcolsep}{18pt}") ];

    doc.addglobalcommands(commands); ```

  4. Then you can add different Items