Crates.io | rust-texas |
lib.rs | rust-texas |
version | 0.3.5 |
source | src |
created_at | 2023-08-12 12:39:31.445717 |
updated_at | 2024-05-31 14:39:03.74276 |
description | Crate to generate latex documents |
homepage | |
repository | https://github.com/Abhay478/texas |
max_upload_size | |
id | 942720 |
size | 70,007 |
rust-texas
.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. https://github.com/Abhay478/texas/issues
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!("book");
write!(q, "{}", doc.to_string())?
Component
s (inclluding Label
s, Reference
s, Environment
s, etc.), Package
s, and Command
s. They can be created using both functions and macros.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:let mut p1 = part!("one");
p1.attach(chapter!("c1"))?
.attach(chapter!("c2"))?; // and so on.
p1.attach_vec(vec![chapter!("c3"); 2])?;
doc.new_component(p1);
Command
s can be created and installed like so:doc.new_command(Command::new("brak", 1, r"\ensuremath{\left(#1\right)}"));
let mut p1 = section!("one");
p1.attach(command!(doc, "brak", "hello there"))?;
Package
s can be created and installed too:doc.new_package(package!("parskip", "parfill"));
Opt
, which allows for adding options to a command (like usepackage
and documentclass
, for now).
We have a lot of them.
These are regions in the document.
Support for beamer has been around since 0.3.0. The following components are available:
Well, I haven't added all of them. You can't make your own environments (that's upcoming) but you can use any environment with the Environment
struct.
TextType
enum for more.&
. Can be used in align
environments too.\phi
, \infty
) and stuff (\ensuremath
). Refer the BuiltinType
enum for more.Beamer
documentclass.
TextType
s.with_components
methods to various structs.texas
-y, just add use rust_texas::prelude::*;
.component.rs
and document.rs
into multiple files.graphicx
and hyperref
by default.TextType
s.Opt
, namely that it was doing nothing for environments.