From 7c683db3673187260ef2fa84d779ff81cb05aba8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 31 Dec 2022 09:37:55 +0100 Subject: Merge `MarkupNode` and `MathNode` into `Expr` --- src/model/value.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/model/value.rs') 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 { -- cgit v1.2.3