This question follows on from the answer given by Michael Pilat in Preventing “Plus” from rearranging things. There he defined a custom +
notation using
I consulted with a colleague about this, and his recommendation was essentially that putting up-value definitions on MakeBoxes
as you demonstrate is better than using Format
when you want things to be tightly integrated from output back to input. Format
isn't really intended to produce output that can be re-used as input, but just to format output, hence the unexpected recursion with Interpretation
when converting to StandardForm
, etc.
You might find the function ToBoxes a useful complement to MakeBoxes
.
Finally, here's a tutorial about box structures.
HTH!