tex_rs/
lib.rs

1//! Tex-rs <br>
2//! Started Development: February 2022 <br>
3//! License: MIT <br>
4//! From: Mustafif Khan | MKProjects <br>
5//! This crate is to be a library to generate LaTeX documents using a concept
6//! of attaching document elements. The example below shows how to utilize this library:
7
8//! ```
9//! use tex_rs::*;
10//! use std::path::Path;
11//!
12//! fn main() {
13//!     use std::path::PathBuf;
14//! let mut latex = latex::Latex::new();
15//!     latex.set_class(Class::Book);
16//!     latex.set_metadata(Metadata::default());
17//!     latex.add_package("dramatist".to_owned());
18//!
19//!     let mut part_one = Part::new("Part 1");
20//!     let section_one = Section::new("Section 1");
21//!
22//!     let mut part_two = Part::new("Part 2");
23//!     let mut chapter = Chapter::new("Chapter");
24//!     let text = Text::new("text in part 2", TextType::Roman);
25//!
26//!     part_one.attach(Element::from(section_one)).unwrap();
27//!     chapter.attach(Element::from(text)).unwrap();
28//!     part_two.attach(Element::from(chapter)).unwrap();
29//!
30//!     let mut env = Environment::new("equation");
31//!     env.attach_string("x^2 + y^2 = z^2".to_owned());
32//!
33//!     part_two.attach(Element::from(env)).unwrap();
34//!
35//!     let mut list = List::new(ListMode::Enumerate, &vec!["item 1".to_owned(), "item 2".to_owned(), "item 3".to_owned()]);
36//!
37//!     part_two.attach(Element::from(list)).unwrap();
38//!
39//!     latex.set_elements(elements![part_one, part_two]);
40//!
41//!     latex.write(Path::new("simple.tex").to_path_buf()).unwrap()
42//! }
43
44//! ```
45
46pub use element::*;
47pub use error::*;
48pub use latex::*;
49pub use traits::*;
50
51/// Contains all Element related structs/enums
52pub mod element;
53/// Contains all custom error handling
54pub mod error;
55/// Contains all of the core functionality with the Latex struct
56pub mod latex;
57/// Contains all of the traits for the structs/enums
58pub mod traits;