MathGroup Archive 2007

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

Search the Archive

Re: Best practise for defining shortened display versions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80410] Re: [mg80370] Best practise for defining shortened display versions
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Tue, 21 Aug 2007 05:10:58 -0400 (EDT)
  • References: <200708200738.DAA18725@smc.vnet.net>

Andrew Moylan wrote:

>Expressions with head InterpolatingFunction display in a shortened format in
>StandardForm:
>
>Evaluating:
>
>InterpolatingFunction[{{1, 4}}, {3, 1, 0, {4}, {4}, 0, 0, 0, 
>  0}, {{1, 2, 3, 4}}, {{1}, {4}, {9}, {16}}, {Automatic}]
>
>yields:
>
>InterpolatingFunction[{{1,4}},<>]
>
>How does InterpolatingFunction[] do this? Is it via custom definitions for
>MakeBoxes[] or ToBoxes[] or Format[]?
>
It is done via custom definitions for MakeBoxes.

> What is the best way to do this for my
>own functions?
>
>  
>
You can use either MakeBoxes or Format. The advantage of using Format is 
that you don't have to worry about using boxes, so that you don't have 
to learn about boxes, and your code will be easier to understand when 
you look back at it later. The advantage of using MakeBoxes is that you 
have better control over what the appearance will be and more options in 
which boxes you can use. There are boxes which don't have a nonbox input 
form.

I like using Format if the new formatting isn't complicated, such as in 
the InterpolatingFunction example above. On the other hand, if I want to 
change formatting of an existing kernel function I will use MakeBoxes.

If you use MakeBoxes, be sure to use TagSet. This way you can clear 
MakeBoxes definitions, and you can use FormatValues to figure out the 
formatting definitions you created for your symbols.

Carl Woll
Wolfram Research


  • Prev by Date: lower diagonal matrix
  • Next by Date: Re: Documentation Center (Mathematica Help) problem and solution
  • Previous by thread: Best practise for defining shortened display versions of custom functions
  • Next by thread: Iteratively determing successive values from previous values....