Crate texcore

source ·
Expand description

Examples

use std::io::Error;
use std::path::PathBuf;

use texcore::Elements;
use texcore::*;

fn main() -> Result<(), Error> {
    let metadata = Metadata::new("Author", "date", "title", 11, "book", "article", true);
    let mut list = ElementList::new(&metadata);
    let part = Part::new("part");
    let chapter = Chapter::new("chapter");
    let header1 = Header::new("header1", 1);
    let header2 = Header::new("header2", 2);
    let text = Text::new("text", TextType::Normal);
    let pkg = Package::new("dramatist");
    list.push_array(Elements![part, chapter, header1, header2, text, pkg]);
    // To compile, use the `compile` feature
    // list.compile(PathBuf::from("test.pdf"))?;
    // To write to single tex file:
    list.write(PathBuf::from("test.tex"))?;
    // To split write Packages and Main file:
    let input = Input::new(PathBuf::from("structure"), Level::Meta);
    list.write_split(
        PathBuf::from("main.tex"),
        PathBuf::from("structure.tex"),
        input,
    );
    // To print:
    list.print_tex();
    Ok(())
}

Re-exports

Modules

  • Provide bundles of Elements for different common use cases
  • Element controls everything related to Elements and ElementList
  • futureasync
    Provides asynchronous methods using the type TexAsync
  • Level controls where each element goes
  • templatetexcreate_template
    Provides the Template type for the TexCreate project
  • Type controls the different kinds of latex elements

Macros

  • returns a vector of Element<Any>
  • Provide a way to wrap an item under a feature
  • Provide a way to wrap an item under not a feature

Functions

  • compilecompile
    Compiles a tex file to a pdf file