1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::io::Result;
use std::path::PathBuf;
use texcore::bundle::tables::*;
use texcore::TextType::Normal;
use texcore::{Element, ElementList, Elements, Metadata, Text};

fn rows() -> Vec<Row> {
    let row_els = vec![
        Elements![
            Text::new("foo", Normal),
            Text::new("bar", Normal),
            Text::new("baz", Normal)
        ],
        Elements![
            Text::new("baz", Normal),
            Text::new("foo", Normal),
            Text::new("bar", Normal)
        ],
    ];
    vec_to_rows(row_els)
}

fn columns() -> Vec<Column> {
    vec![
        Column::new(Position::Left, Separator::Single),
        Column::new(Position::Centered, Separator::Single),
        Column::new(Position::Right, Separator::Single),
    ]
}

fn main() -> Result<()> {
    let table = Table::new(None, columns(), rows(), false, false);
    let mut list = ElementList::new(&Metadata::default());
    list.push(Element::from(table));
    list.write(PathBuf::from("test.tex"))?;
    Ok(())
}