summaryrefslogtreecommitdiff
path: root/src/model/value.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/value.rs')
-rw-r--r--src/model/value.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/value.rs b/src/model/value.rs
index 1c687d8d..0716985d 100644
--- a/src/model/value.rs
+++ b/src/model/value.rs
@@ -112,6 +112,15 @@ impl Value {
_ => item!(raw)(self.repr().into(), Some("typc".into()), false),
}
}
+
+ /// Return the display representation of the value in math mode.
+ pub fn display_in_math(self) -> Content {
+ match self {
+ Self::Int(v) => item!(math_atom)(format_eco!("{}", v)),
+ Self::Float(v) => item!(math_atom)(format_eco!("{}", v)),
+ _ => self.display(),
+ }
+ }
}
impl Default for Value {