MathGroup Archive 2011

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

Search the Archive

Re: How the final "typeset" expression of TableForm is generated?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119495] Re: How the final "typeset" expression of TableForm is generated?
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Mon, 6 Jun 2011 07:28:47 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

On Mon, 6 Jun 2011 11:19:23 +0500, Alexey Popkov wrote:
> Hello,
>
> If we evaluate
>
> ToBoxes[TableForm[{1}]]
>
> we get:
>
> TagBox[TagBox[
> GridBox[{{"1"}}, ColumnAlignments -> Left, RowSpacings -> 1,
> ColumnAlignments -> Left], Column],<...>]
>
> But it is not the expression we see when pressing Ctrl+Shift+E in the
> FrontEnd in the cell generated by evaluating
>
> TableForm[{1}]
>
> That expression has rather different GridBox internals:
>
> GridBox[{{"1"}},
> GridBoxAlignment -> {"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
> "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, < ... >]
>
> I thought before that ToBoxes always allows us to get the final "typeset"
> expression used by the FrontEnd but in this case it does not work. Why?
> How this expression could be generated by a user from the original
> expression "TableForm[{1}]"?

It does.  Try:

ToBoxes[TableForm[{1}]] // RawBoxes

and you'll see that it's generating the exact same cell expression as 
TableForm[{1}] does.  ToBoxes is returning precisely what the kernel sends to 
the front end without variation (except, in the general case, for the evaluation 
semantics and side effects possibly being different, but that's not an issue in 
your example).

The issue is that the front end has two different specifications for specifying 
GridBox options...one of which dates back to version 3, and the other, more
expansive set dates to version 6.  The front end understands both sets of 
options, but canonicalizes anything it receives to the version 6 options.

GridBox is the only box which has had such a wholesale change of options, and it was necessary to support new functionality we added in v6.  But the front end 
will continue to understand the old options for a seriously long time (probably 
forever), as the old options show up not only in certain kernel typesetting
constructs, but in legacy notebook files.

Sincerely,

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


  • Prev by Date: Re: Getting a chess with circles
  • Next by Date: COLLATZ Conjecture - proven?
  • Previous by thread: Re: plotting contours on a sphere [CORRECTION]
  • Next by thread: Re: How the final "typeset" expression of TableForm is generated?