Re: GridBox coming back unevaluated
- To: mathgroup at smc.vnet.net
- Subject: [mg65572] Re: GridBox coming back unevaluated
- From: bghiggins at ucdavis.edu
- Date: Sat, 8 Apr 2006 00:45:15 -0400 (EDT)
- References: <e15eha$2r1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
What you need to do is wrap Range with ToExpression as follows: DisplayForm[GridBox[Partition[ToExpression[Range[9]],3], RowLines->True, ColumnLines->True]] Apparently, the output from Range in the form of boxes is not being interpreted. The function ToExpressions forces the boxes to be interpreted as a Mathematica expression. Cheers, Brian J Siehler wrote: > Hello, group, > > I'm perplexed by the results of the following > > GridBox[Table[3i + j, {i, 0, 2}, {j, 1, 3}], RowLines -> True, > ColumnLines -> True] //DisplayForm > > GridBox[Partition[Range[9], 3], RowLines -> True, ColumnLines ->True] > // DisplayForm > > The first returns a nicely formatted box; the second does not. Tracing > the execution of the two shows that they both arrive, of course, at > > GridBox[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, RowLines -> True, > ColumnLines -> True] > > but only the first proceeds from that point to returning > two-dimensional output. > > Here is a minor variation: > > m = {{1, 2}, {3, 4}} > ma = Append[m, {5, 6}] > mb = Append[m, Range[5, 6]] > ma === mb > > GridBox[ma] // DisplayForm > GridBox[mb] // DisplayForm > > The penultimate line returns a 2D box; the last line does not. Anyone > care to enlighten me?