3
$\begingroup$

Units with micro μ prefix needs internet connection to interpret. For example,

Quantity[1, "μm"]

Though after one such interpretation, Quantity remembers it. However, it only remembers it in this particular kernel session. Is it possible to make Quantity remember such interpretation for all future kernel sessions?

$\endgroup$
4
  • 2
    $\begingroup$ Use "Micrometers" instead? $\endgroup$
    – Michael E2
    Commented Jun 25, 2022 at 14:04
  • $\begingroup$ BTW, people here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful $\endgroup$
    – Michael E2
    Commented Jun 25, 2022 at 14:05
  • $\begingroup$ @MichaelE2 Thank you for reply. I know "Micrometers", and I know I need to try to post code, but I thought the blue part should better shown in image, so I just post them together in one image : ) $\endgroup$
    – matheorem
    Commented Jun 25, 2022 at 14:09
  • 1
    $\begingroup$ I knew you knew that, :). I just went to copy the code, and I couldn't. I'll just assume it doesn't work. Though maybe it does? $\endgroup$
    – Michael E2
    Commented Jun 25, 2022 at 14:15

1 Answer 1

7
$\begingroup$

I suggest using "Micrometers", but if not, this works in V13.0.1:

Block[{QuantityUnits`$UnitAlternateStandardNameReplacements = 
   Append[QuantityUnits`$UnitAlternateStandardNameReplacements, 
    "mum" -> "Micrometers"]},
 Quantity[1, "mum"]
 ]

(*  Quantity[1, "Micrometers"]  *)

Use whatever string you prefer instead of "mum".

$\endgroup$
2
  • $\begingroup$ This is great. Thank you so much. I do not know QuantityUnits`$UnitAlternateStandardNameReplacements has this feature : ) $\endgroup$
    – matheorem
    Commented Jun 25, 2022 at 14:19
  • 1
    $\begingroup$ @matheorem You're welcome. It is internal, undocumented, and subject to change, of course. $\endgroup$
    – Michael E2
    Commented Jun 25, 2022 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.