use crate::ast::{BinaryOp, ExprKind, Expression};
pub(super) fn wrap_if_additive(expr: &Expression) -> String {
match &expr.kind {
ExprKind::Binary {
op: BinaryOp::Add | BinaryOp::Sub | BinaryOp::PlusMinus | BinaryOp::MinusPlus,
..
} => format!(r"\left({}\right)", expr.to_latex()),
_ => expr.to_latex(),
}
}
pub trait ToLatex {
fn to_latex(&self) -> String;
}
pub(super) const KNOWN_FUNCTIONS: &[&str] = &[
"sin", "cos", "tan", "cot", "sec", "csc", "arcsin", "arccos", "arctan", "arccot", "arcsec",
"arccsc", "sinh", "cosh", "tanh", "coth", "sech", "csch", "ln", "log", "exp", "lg", "det",
"dim", "ker", "hom", "arg", "deg", "gcd", "lcm", "max", "min", "sup", "inf", "lim", "limsup",
"liminf",
];