Possible Duplicate:
Simpler input for the new unit support

Is there a way to input abbreviated units directly from the keyboard? One can get a value with abbreviated units through the Wolfram/Alpha interface (below) and then clicking on the lower box, but I'd like to be able to type it in directly.

enter image description here

  • $\begingroup$ @Szabolcs: I think you're right--that's basically the same question. Unfortunately, I was hoping for a simple "type this" answer, but it doesn't look like that's the case. Should I withdraw this question? $\endgroup$ – Cassini Dec 3 '12 at 19:15
  • $\begingroup$ I agree that this is an important question and that there's no really satisfactory answer on the other version ... Just trying to keep the site clean---and it seems this is really an exact duplicate. I'd say let's just keep this question as another Google entry point to this (soon very frequently asked) question, even if closed. $\endgroup$ – Szabolcs Dec 3 '12 at 19:20
  • $\begingroup$ This should be reopened. The question seems very different from the proposed duplicate. I don't see it at all. This question is much more concise and has nothing to do with packages. Correspondingly, the answers are of a very different character. Itai's answer, in particular, is very good and has no parallel in the other question. $\endgroup$ – Mark McClure Dec 4 '12 at 14:05
  • $\begingroup$ @MarkMcClure The package stuff in the other question was relatively recent and was actually an update by the OP. The core of the question is exactly the same. I've now moved the update part to the bottom. $\endgroup$ – rm -rf Dec 4 '12 at 15:26

If you want something that displays in abbreviated from, you can do the following:

  1. Type Quantity[number, "unitstring"], for example Quantity[5, "m"].

  2. Select that expression (pressing Ctrl. twice will do that if you haven't moved the cursor).

  3. Perform Evaluate In Place (CtrlShiftEnter on Windows and Linux, CmdEnter on OS X). This will give you something that looks like 5 m but is in fact a full Quantity expression.


You can just type "50 m/s" in a WolframAlpha box, like you have. If you want to enter it in "pure Mathematica", without going through W|A, you can use Quantity["50 m/s"]. See its documentation here: http://reference.wolfram.com/mathematica/ref/Quantity.html

  • 1
    $\begingroup$ I think the main question was: how to avoid typing Quantity and avoid W|A (which is slow and requires an internet connection). $\endgroup$ – Szabolcs Dec 3 '12 at 19:21
  • $\begingroup$ @Szabolcs: precisely. $\endgroup$ – Cassini Dec 3 '12 at 19:38

You can abbreviate a bit by using a single string which is interpreted as the second argument of Quantity. The process might not always give you exactly what you want, however.

Quantity[50, "mps"] // InputForm
(* Out: Quantity[50, "Miles"/"Seconds"] *)

Quantity[5, "meters per s"] // InputForm
(* Out: Quantity[5, "Meters"/"Seconds"] *)

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