5
$\begingroup$

Is there a way to display Quantity[] in full form in the output? I know you could use Quantity[valuse, Unit]//InputForm, but what I want is something like Quantity[Placeholder["tip"], "Meters"], but with an actual named placeholder instead of the code.

(I am trying to use this in the user interface, so the the placeholder could also serve as a tooltip box. This is something I would hope it could looklike: enter image description here)

$\endgroup$

2 Answers 2

8
$\begingroup$
Defer[Quantity][Placeholder["tip"],"Meters"]

enter image description here

or

HoldForm[Quantity][Placeholder["tip"],"Meters"]

enter image description here

The second method requires ReleaseHold to evaluate.

$\endgroup$
5
$\begingroup$

You can also use Inactive in V10, of course the appearance will be slightly different.

Inactive[Quantity][Placeholder["Tooltip"], "Meters"]

Mathematica graphics

And use Activate to evaluate it:

$\endgroup$

Your Answer

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

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