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
use crate::{BracketsLevel, TensorExpression};
use std::collections::HashMap;

impl TensorExpression {
    pub fn _tex_code(
        &self,
        symbols: &HashMap<&str, &str>,
        brackets_level: BracketsLevel,
    ) -> String {
        match self {
            TensorExpression::KroneckerDeltas(rank_pairs) => {
                TensorExpression::tex_code_kronecker_deltas(rank_pairs, brackets_level)
            }
            TensorExpression::DotProduct {
                terms,
                rank_combinations,
            } => TensorExpression::tex_code_dot_product(terms, rank_combinations, symbols),
            TensorExpression::DirectProduct(terms) => {
                TensorExpression::tex_code_direct_product(terms, symbols, brackets_level)
            }
        }
    }

    pub fn tex_code(&self, symbols: &HashMap<&str, &str>) -> String {
        self._tex_code(symbols, BracketsLevel::None)
    }
}