Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: MakeBoxes on v7.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97153] Re: MakeBoxes on v7.0
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Fri, 6 Mar 2009 04:27:46 -0500 (EST)
  • References: <goo7k8$sgi$1@smc.vnet.net>

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
>
>
The correct definition is:

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

I.E. you have to recursively call MakeBoxes on both the expression i and
on the head h - which needs to be converted into a string for the boxes
to work properly.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: MakeBoxes on v7.0
  • Next by Date: Re: How to express the results in normal cdf instead of erf()
  • Previous by thread: Re: MakeBoxes on v7.0
  • Next by thread: Re: MakeBoxes on v7.0