Open GoodStuff11 opened 3 months ago
What MIME would you use it with? The nice thing of the -123.4 ± 5.6
representation is that that's valid Julia code, but -123.4(56)
wouldn't.
While -123.4 ± 5.6
is a very practical representation for code, it would be useful for me to allow for converting it to a string format like "-123.4(56)"
since that's the form I want to be pasting into my Latex document.
I imagine it could have a MIME like text/x-plain
or text/unc-p
, though I'm no expert at naming these things.
Ok, yeah, you can define a custom MIME, like we do for text/latex
and text/x-latex
: https://github.com/JuliaPhysics/Measurements.jl/blob/833064e4a4dca58be82ceaaa257d96a6b3708cfe/src/show.jl#L52-L62
I noticed that in the package you can use
measurement
to convert" -123.4(56) "
into-123.4 ± 5.6
. But is there a way to take the Measurement object and output a string formatted with parentheses to denote uncertainties like"-123.4(56)"
.Ideally, it would be of the form
repr("text/something", -123.4 ± 5.6) ≈ "-123.4(56)"