TagBox

The feature named TagBox is essential to an improved Units package I  wrote and have posted at  
http://library.wolfram.com/database/MathSource/4283  
The usage message for TagBox is given below.

? TagBox

TagBox[boxes, tag] displays as boxes but maintains tag to   guide the interpretation of boxes on input. More…


The second argument in TagBox is the head the should have rather than the
head normally used for the boxes displayed.  Only one line of code is needed
to demonstrateTagBox.

MakeBoxes[UnitsWrapper[expr_, u_], form : (StandardForm | TraditionalForm)] := TagBox[RowBox[{MakeBoxes[expr, form], " ", MakeBoxes[u, form]}], UnitsWrapper]


After evaluating the cell above the output of the next cell looks like
Times[0,Second] which would evaluate to 0, but the fullform of the expression
is actually UnitsWrapper[0, Second].

expr = UnitsWrapper[0, Second]

0 Second

FullForm[expr]

UnitsWrapper[0, Second]


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page