Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.3K Views
|
10 Replies
|
1 Total Like
View groups...
Share
Share this post:
GROUPS:

Undesired parenthesis

Attachments:
10 Replies

If you are fastidious about the proper math formating (fonts and spacings), try this:

Print[Framed[ DisplayForm@ FormBox[RowBox[{"v", "=", NumberForm[Quantity[10.38, ("Meters")/("Seconds")], 2]}], TraditionalForm]]]

I found out about FormBox by hitting the menu Cell > Show Expression.

POSTED BY: Gianluca Gorni

This was really something! Thanks.

Use the following instead:

Print[Framed[
  Row[{"v = ", 
    NumberForm[Quantity[10.38, ("Meters")/("Seconds")], 2]}]]]

The issue you were having was because "v=" NumberForm[...] means Times["v=",NumberForm[...]] and so the syntax form of the underlying quantity was taking over, because a string times a quantity doesn't evaluate. Another example of this would be:

"v=" RawBoxes@InterpretationBox[10, 10, SyntaxForm -> Mod]
POSTED BY: Nick Lariviere

Perfect. Thanks a lot.

Thanks for replying, but the argument of NumberForm function cannot be changed.

POSTED BY: Daniel Lichtblau

Thanks. Your solution is almost perfect, except by the lost of the output format.

Did you miss the part "Also Text is not needed though to my eye it is useful for formatting"? It's there for a reason..

POSTED BY: Daniel Lichtblau
Framed[
 Text[Row[{"v = " , NumberForm[10.38, {4, 2}], " meters/second"}]]]
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard