Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

20 views
Skip to first unread message

John Fultz

unread,
Jun 6, 2011, 7:28:56 AM6/6/11
to
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
jfu...@wolfram.com
User Interface Group
Wolfram Research, Inc.

0 new messages