def label(self) -> str:
        """A latex formatted label representing constant expression and united value."""
        label = self.expression.replace("_", "\\;")
        if self.units_kind:
            symbol = wt_units.get_symbol(self.units)
            for v in self.variables:
                vl = "%s_{%s}" % (symbol, v.label)
                vl = vl.replace("_{}", "")  # label can be empty, no empty subscripts
                label = label.replace(v.natural_name, vl)
                val = (
                    round(self.value, self.round_spec)
                    if self.round_spec is not None
                    else self.value
                )
        label += r"\,=\,{}".format(format(val, self.format_spec))
        if self.units_kind:
            units_dictionary = getattr(wt_units, self.units_kind)
            label += r"\,"
            label += units_dictionary[self.units][2]
        label = r"$\mathsf{%s}$" % label
        return label
def label ( self ) -> str : label = self . expression . replace ( "_" , "\\;" ) if self . units_kind : symbol = wt_units . get_symbol ( self . units ) for v in self . variables : vl = "%s_{%s}" % ( symbol , v . label ) vl = vl . replace ( "_{}" , "" ) label = label . replace ( v . natural_name , vl ) val = ( round ( self . value , self . round_spec ) if self . round_spec is not None else self . value ) label += r"\,=\,{}" . format ( format ( val , self . format_spec ) ) if self . units_kind : units_dictionary = getattr ( wt_units , self . units_kind ) label += r"\," label += units_dictionary [ self . units ] [ 2 ] label = r"$\mathsf{%s}$" % label return label
A latex formatted label representing constant expression and united value.