MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MakeBoxes on v7.0

  • To: mathgroup at
  • Subject: [mg97131] Re: [mg97107] MakeBoxes on v7.0
  • From: John Fultz <jfultz at>
  • Date: Fri, 6 Mar 2009 04:23:48 -0500 (EST)
  • Reply-to: jfultz at

On Thu, 5 Mar 2009 04:56:37 -0500 (EST), Mariano Su=E1rez-Alvarez wrote:
> Hi all,
> after executing this on v7.0
> h /: MakeBoxes[h[i_], StandardForm] := SubscriptBox[h, MakeBoxes[i,
> StandardForm]]
> evaluating h[4] results not in an h with a subscript, but in Global`h
> with
> the expected subscript. Is that intentional? This code is very
> close to an example in the documentation for MakeBoxes...
> -- m

Any box argument presented directly on-screen (as opposed to, for example, the 
tag of a TagBox, the symbolic expr of a DynamicBox, the variables of a 
DynamicModuleBox) should always be a string.  So, your example is easily fixed 
by doing...

h /: MakeBoxes[h[i_], StandardForm] := 
 SubscriptBox["h", MakeBoxes[i, StandardForm]]

Also correct, but unnecessarily verbose for this particular example, would be...

h /: MakeBoxes[h[i_], StandardForm] := 
 SubscriptBox[MakeBoxes[h, StandardForm], MakeBoxes[i, StandardForm]]

Using, e.g., SubscriptBox with symbols rather than strings has always been bad 
form, but in versions of Mathematica prior to version 6, it would have appeared 
to work as those versions were not as strict in handling the Box argument types. 
Tightening up the argument handling was necessary for us to properly support

John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

  • Prev by Date: Re: Re: Conjecture: 2n+1= 2^i+p ; 6k-2 or 6k+2 = 3^i+p
  • Next by Date: Re: Huge memory consumption of GIF.exe
  • Previous by thread: Re: MakeBoxes on v7.0
  • Next by thread: Exporting a Manipulate[]