pub struct MathCoreConfig {
pub pretty_print: PrettyPrint,
pub macros: Vec<(String, String)>,
pub xml_namespace: bool,
pub ignore_unknown_commands: bool,
pub annotation: bool,
pub allow_unreliable_rendering: bool,
pub global_group: bool,
pub unicode_substitution: UnicodeSubstitution,
pub css_classes: CssClassNames,
pub indentation: Indentation,
pub max_expansions: MaxExpansions,
pub id_prefix: String,
}Expand description
Configuration object for the LaTeX to MathML conversion.
§Example usage
use math_core::{MathCoreConfig, PrettyPrint};
// Default values
let config = MathCoreConfig::default();
// Specifying pretty-print behavior
let config = MathCoreConfig {
pretty_print: PrettyPrint::Always,
..Default::default()
};
// Specifying pretty-print behavior and custom macros
let macros = vec![
("d".to_string(), r"\mathrm{d}".to_string()),
("bb".to_string(), r"\mathbb{#1}".to_string()), // with argument
];
let config = MathCoreConfig {
pretty_print: PrettyPrint::Auto,
macros,
..Default::default()
};Fields§
§pretty_print: PrettyPrintA configuration for pretty-printing the MathML output. See PrettyPrint for details.
macros: Vec<(String, String)>A list of LaTeX macros; each tuple contains (macro_name, macro_definition).
A macro may use another macro of this list, no matter which of the two comes first.
xml_namespace: boolIf true, include xmlns="http://www.w3.org/1998/Math/MathML" in the <math> tag.
ignore_unknown_commands: boolIf true, unknown commands will be rendered as red text in the output, instead of
returning an error.
annotation: boolIf true, wrap the MathML output in <semantics> tags with an
<annotation encoding="application/x-tex"> child containing the original LaTeX source.
allow_unreliable_rendering: boolIf true, allow rendering commands that produce MathML Core output that is unreliably
rendered by browsers.
global_group: boolIf true, run the conversion in the global group, which means that commands defined at
the top level of a snippet with \newcommand (and related commands) stay defined for the
snippets which come after it.
If false (the default), such definitions are local to the snippet which contains them.
This matches LaTeX, where constructs like \begin{equation} and $$ open a local group,
and it matches the default behavior of KaTeX.
unicode_substitution: UnicodeSubstitutionIf not UnicodeSubstitution::Never, substitute certain LaTeX commands with their Unicode
equivalents in the MathML output.
css_classes: CssClassNamesCSS class names for various elements in the output.
indentation: IndentationThe indentation unit used when pretty-printing the MathML output. Either a number of spaces
(e.g. 2) or the string "tab" for a tab character. See Indentation.
max_expansions: MaxExpansionsHow many custom commands may be expanded in one snippet before the conversion gives up.
See MaxExpansions.
id_prefix: StringAdd this string to the start of every generated id attribute.
This is not URL escaped. Use the
percent-encoding crate if you need to.