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.
Document
, which you populate per your whims and fancies. This can be written to a file like so: rust
let mut q = File::create("file.tex")?;
let doc = Document::new(DocumentClass::new("book"));
write!(q, "{}", doc.to_string())?
- The document can be filled with Component
s, Package
s and Command
s.
- Component
is an enum, with each variant containing a separate struct. If a component impl
s the Populate
trait, you can fill it with more Component
s, then install it in the Document
like so:
```rust let mut p1 = Part::new("one"); p1.attach(Component::Chapter(Chapter::new("c1")))? .attach(Component::Chapter(Chapter::new("c2")))?;
doc.newcomponent(Component::Part(p1));
- `Command`s can be created and installed like so:
doc.newcommand(Command::new("brak", 1, "\ensuremath{\left(#1\right)}"));
- And commands can be called in-text like so:
rust
let mut p1 = section!("one");
p1.attach(Component::Command(
doc.getcommand("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:
rust
let mut p1 = Package::new("parskip");
p1.addoption("parfill");
doc.new_package(p1);
``
- Also has trait
Opt, which allows for adding options to a command (like
usepackageand
documentclass`, for now).
Commands were seriously buggy, so some breaking changes.