Texas 0.1.8

Crate to generate latex documents
Documentation
Texas-0.1.8 has been yanked.

Texas

Purpose

This crate does not, in any way, even remotely cover the vast variety of things you can do with latex. Instead, it attempts to provide a friendly API for some of the most basic functions. Furthermore, it does not catch most latex errors.

It's also my first foray into the open-source world, so constructive criticism is welcome and appreciated.

Basics

  • The primary type is Document, which you populate per your whims and fancies. This can be written to a file like so:
let mut q = File::create("file.tex")?;
// let doc = Document::new(DocumentClass::new("book"));
let doc = document!("book");
write!(q, "{}", doc.to_string())?
  • The document can be filled with Components, Packages and Commands. They can be created using both functions and macros.
  • Component is an enum, with each variant containing a separate struct. If a component impls the Populate trait, you can fill it with more Components, then install it in the Document like so:
let mut p1 = Part::new("one");
p1.attach(Component::Chapter(Chapter::new("c1")))?
    .attach(Component::Chapter(Chapter::new("c2")))?;

p1.attach_vec(vec![chapter!("c3"); 2])?;

doc.new_component(Component::Part(p1));
  • Commands can be created and installed like so:
doc.new_command(Command::new("brak", 1, "\\ensuremath{\\left(#1\\right)}"));
  • And commands can be called in-text like so:
let mut p1 = section!("one");
p1.attach(Component::Command(
    doc.get_command("brak")?.call(vec!["hello"])?,
))?;
p1.attach(command!(doc, "brak", "there"))?;
  • Will add ability to generate stuff like ensuremath from code eventually.
  • Packages can be created and installed like so:
// let mut p1 = Package::new("parskip");
// p1.add_option("parfill");
let mut p1 = package!("parskip", "parfill");
doc.new_package(p1);
  • Also has trait Opt, which allows for adding options to a command (like usepackage and documentclass, for now).

  • As of 0.1.7, re-exported crate::document, crate::component, crate::commands, crate::errors

Log

  • 0.1.7

    • package! macro wasn't working, fixed that.
    • Moved the modules to the front (re-imported them in lib.rs) for convenience.
  • 0.1.8

    • Small whoops. Latex errors due to Line code.

Future

  • Add subsubsections
  • Add new componnt variant for description lists
  • Maybe some handy mathy shortcuts (like the aforementioned ensuremath)