Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

So I've developed this simple code

Mes /: MakeBoxes[Mes[mess_, error_, unit_], 
                 form : (StandardForm | TraditionalForm) : StandardForm
                ] := RowBox[{
                   MakeBoxes[NumberForm[Quantity[mess ± error, unit], {20, 2}], form]}]

in order to easily print things like this:

NumberForm[Quantity[1 ± 0.1, "picoFarads"], {20, 2}]

which give a nice output:

(1.00 ± 0.10) pF

but using the Mes structure:

Mes[1, 0.1, "picoFarads"]

gives me:

Quantity[1.00 ± 0.10,picoFarads]

On the other hand:

Mes[1, 0.1, "Farads"]

gives:

(1.00 ± 0.10) F

I'm not sure what's going on but it seems to be connected with internet connection needed to interpret the units. How can I make MakeBoxes wait for the unit to get interpreted?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.