Re: Question about alignment in Grid and TableForm
- To: mathgroup at smc.vnet.net
- Subject: [mg88509] Re: Question about alignment in Grid and TableForm
- From: Albert Retey <awnl at arcor.net>
- Date: Wed, 7 May 2008 07:06:32 -0400 (EDT)
- References: <fvmmpe$8br$1@smc.vnet.net>
Alexey Popkov schrieb: > Hello, > I wish text objects in Grid would be aligned at center of column and > numbers in ScientificForm aligned at ".". I have tried to use the > following constructions as elements of the Grid but the text objects > are not centered at the centers of columns: > > Item["some text", Alignment -> Center] > and > Item[1000*Pi // ScientificForm, Alignment -> "."]. > > The code I have tried (it is just example): > > TableForm[ > Insert[Table[ > Item[N[Pi a^10] // ScientificForm, Alignment -> "."], {a, 1, > 5}, {b, 1, 3}], {Item["First Column text", Alignment -> Center], > Item["Second Column text", Alignment -> Center], > Item["Third Column text", Alignment -> Center]}, 3]] > > Grid[Insert[ > Table[Item[N[Pi a^10] // ScientificForm, Alignment -> "."], {a, 1, > 5}, {b, 1, 3}], {Item["First Column text", Alignment -> Center], > Item["Second Column text", Alignment -> Center], > Item["Third Column text", Alignment -> Center]}, 3]] > > How to place text objects at the centers of the columns? Is this a bug > in "Alignment" option? > I don't think so, it is usually a good idea to use the Dividers->All option when constructing tables so you can see what really happens. As you can see, the text _is_ centered, it's the dot-alignment which causes the look of the table to be different from what you expect: Grid[ Insert[Table[ Item[N[Pi a^10] // ScientificForm, Alignment -> "."], {a, 1, 5}, {b, 1, 3}], {Item["First Column text", Alignment -> Center], Item["Second Column text", Alignment -> Center], Item["Third Column text", Alignment -> Center]}, 3], Dividers -> All ] you might want to experiment with the ItemSize option to get more appealing tables... hth, albert