use super::{
Args, BeginEndBlock, Group, IntoTexElement, MacroCall, OptArgs, RawTex, TableRow, TexElement,
};
#[derive(Copy, Clone, Debug)]
pub struct Nothing;
impl Iterator for Nothing {
type Item = String;
#[inline(always)]
fn next(&mut self) -> Option<Self::Item> {
None
}
}
pub const N: Nothing = Nothing;
pub fn cellcolor<S: Into<String>>(color: S) -> MacroCall {
MacroCall::new("cellcolor", OptArgs::default(), Args::single(raw(color)))
}
pub fn description(children: Vec<Box<dyn TexElement>>) -> BeginEndBlock {
BeginEndBlock::new("description", OptArgs::default(), Args::default(), children)
}
#[inline]
pub fn doc(children: Vec<Box<dyn TexElement>>) -> Group {
Group(children)
}
#[inline]
pub fn documentclass<T: IntoTexElement>(
opt_args: Vec<Box<dyn TexElement>>,
doc_class: T,
) -> MacroCall {
MacroCall::new(
"documentclass",
OptArgs::new(opt_args),
Args::single(doc_class),
)
}
#[inline]
pub fn document(children: Vec<Box<dyn TexElement>>) -> BeginEndBlock {
BeginEndBlock::new("document", OptArgs::default(), Args::default(), children)
}
pub fn enumerate(children: Vec<Box<dyn TexElement>>) -> BeginEndBlock {
BeginEndBlock::new("enumerate", OptArgs::default(), Args::default(), children)
}
pub fn footnote<E: IntoTexElement>(footnote_content: E) -> MacroCall {
MacroCall::new(
"footnote",
OptArgs::default(),
Args::single(footnote_content),
)
}
pub fn figure<T: IntoTexElement>(
alignment: T,
children: Vec<Box<dyn TexElement>>,
) -> BeginEndBlock {
BeginEndBlock::new(
"figure",
OptArgs::single(alignment),
Args::default(),
children,
)
}
#[inline]
pub fn group(children: Vec<Box<dyn TexElement>>) -> Group {
Group(children)
}
#[inline]
pub fn hspace<T: IntoTexElement>(space: T) -> MacroCall {
MacroCall::new_inline("hspace", OptArgs::default(), Args::single(space))
}
#[inline]
pub fn includegraphics<T: IntoTexElement>(options: Vec<Box<dyn TexElement>>, path: T) -> MacroCall {
MacroCall::new_inline("includegraphics", OptArgs::new(options), Args::single(path))
}
pub fn item<T: IntoTexElement>(item: T) -> MacroCall {
MacroCall::new("item", OptArgs::default(), Args::single(item))
}
pub fn item_d<T: IntoTexElement, U: IntoTexElement>(desc: T, item: U) -> MacroCall {
MacroCall::new("item", OptArgs::single(desc), Args::single(item))
}
pub fn itemize(children: Vec<Box<dyn TexElement>>) -> BeginEndBlock {
BeginEndBlock::new("itemize", OptArgs::default(), Args::default(), children)
}
#[inline]
pub fn minipage<T: IntoTexElement, U: IntoTexElement>(
alignment: T,
width: U,
children: Vec<Box<dyn TexElement>>,
) -> BeginEndBlock {
BeginEndBlock::new(
"minipage",
OptArgs::single(alignment),
Args::single(width),
children,
)
}
pub fn nothing() -> Box<dyn TexElement> {
"".into_tex_element()
}
#[inline]
pub fn raw<S: Into<String>>(raw: S) -> RawTex {
RawTex::new(raw.into().into_bytes())
}
#[inline]
pub fn section<T: IntoTexElement>(title: T) -> MacroCall {
MacroCall::new("section", OptArgs::default(), Args::single(title))
}
#[inline]
pub fn subsection<T: IntoTexElement>(title: T) -> MacroCall {
MacroCall::new("subsection", OptArgs::default(), Args::single(title))
}
#[inline]
pub fn table_row(cols: Vec<Box<dyn TexElement>>) -> TableRow {
TableRow::new(cols)
}
#[inline]
pub fn tabular<T: IntoTexElement, U: IntoTexElement>(
width: T,
column_definitions: U,
children: Vec<Box<dyn TexElement>>,
) -> BeginEndBlock {
BeginEndBlock::new(
"tabular",
OptArgs::default(),
Args::new(vec![
width.into_tex_element(),
column_definitions.into_tex_element(),
]),
children,
)
}
#[inline]
pub fn tabularx<T: IntoTexElement, U: IntoTexElement>(
width: T,
column_definitions: U,
children: Vec<Box<dyn TexElement>>,
) -> BeginEndBlock {
BeginEndBlock::new(
"tabularx",
OptArgs::default(),
Args::new(vec![
width.into_tex_element(),
column_definitions.into_tex_element(),
]),
children,
)
}
#[inline]
pub fn textbf<T: IntoTexElement>(inner: T) -> MacroCall {
MacroCall::new_inline("textbf", OptArgs::default(), Args::single(inner))
}
#[inline]
pub fn usepackage<T: IntoTexElement>(
opt_args: Vec<Box<dyn TexElement>>,
package_name: T,
) -> MacroCall {
MacroCall::new("usepackage", OptArgs(opt_args), Args::single(package_name))
}
#[inline]
pub fn vspace<T: IntoTexElement>(space: T) -> MacroCall {
MacroCall::new_inline("vspace", OptArgs::default(), Args::single(space))
}