MathGroup Archive 1999

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

Search the Archive

Defining new Forms

Hi, I would greatly appreciate some help on the following problem with
Mathematica 3.0's expression formatting functionality. Assume that we have
objects of the form

LargeObject[lst, stuff]

where "lst" is a (usually large) list of user data and "stuff" denotes some
internal information, for instance

lst = {1, 2, 3, 4, 5}


stuff = {opt1 -> val1, opt2->val2} .

To abbreviate the display, I modified the Format/MakeBoxes rules for
LargeObjects such that StandardForm and OutputForm return this:

In[1]:= obj = LargeObject[lst, stuff]

Out[1]= - LargeObject -

So far, no problem. Now, I also want to be able to display a LargeObject
such that the user data "lst" is shown in its natural form, i.e. as a list
in StandardForm(!), using a new format type "ListForm" as illustrated below.

In[2]:= obj // ListForm

Out[2]//ListForm= {1, 2, 3, 4, 5}

Although I experimented a lot with formatting rules, I was not able to
produce exactly what I want. The definition

Format[ListForm[LargeObject[a_,b_]]] := a

returns the list but without the //ListForm suffix in the cell label,
whereas the definition

Format[LargeObject[a_,b_], ListForm] := a

has no effect at all. However, if *both* Format definitions are executed, I
get both the list output and a correct cell label. Unfortunately, this
causes the output to be printed in OutputForm and not in StandardForm, which
makes selecting the output with the mouse impossible.

Does anyone have an idea how to apply Format and/or MakeBoxes to make the

obj // ListForm

produce the correct output in StandardForm involving RowBoxes etc.?

-- Eckhard

Dipl.-Ing. Eckhard Hennig      mailto:hennig at
Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM)
Erwin-Schroedinger-Strasse,  67663 Kaiserslautern,  Germany
  Voice: +49-(0)631-205-3126    Fax: +49-(0)631-205-4139

     ITWM - Makers of Analog Insydes for Mathematica

  • Prev by Date: Programming the front end
  • Next by Date: Re: Re: adjusting frame size in plot
  • Previous by thread: Re: Programming the front end
  • Next by thread: Re: Defining new Forms