Format and MakeBoxes in depth - Part 1
- To: mathgroup at smc.vnet.net
- Subject: [mg122691] Format and MakeBoxes in depth - Part 1
- From: Rui <rui.rojo at gmail.com>
- Date: Sun, 6 Nov 2011 05:55:45 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
I have actually deep doubts about these functions, but I'll try to start with a small concrete one that bugs me... I define a format for the symbol "lo" Format[lo, StandardForm]:=(Print[""];la[]); Now, if I call MakeBoxes on it, result is what I expected In: MakeBoxes[lo, StandardForm] Out: [Empty line... Print[""]'s fault] RowBox[{"la", "[", "]"}] However, if I look into the definitions In:??lo Out: la[]/:MakeBoxes[la[],StandardForm]:=Format[Print[];la[],StandardForm] Those first 2 la[] I'm pretty sure are actually lo's printed out as la[]. The last one after Print[] should be actually la[]. So it actually means lo/:MakeBoxes[lo,StandardForm]:=Format[Print[];la[],StandardForm] So, if MakeBoxes[lo, StandardForm]:=Format[Print[];la[], StandardForm], how come it returns a box structure when Format[Print[];la[], StandardForm] by itself returns unevaluated?