Re: Grid

*To*: mathgroup at smc.vnet.net*Subject*: [mg76651] Re: Grid*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Fri, 25 May 2007 06:34:37 -0400 (EDT)*Organization*: Uni Leipzig*References*: <f33olt$l3v$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de

Hi, and adding a Framed[] arround the Grid[] does not help you ? Regards Jens Fred Simons wrote: > No doubt one of the big improvements in Mathematica 6 is the function > Grid. I used it already many times with excellent result. > > Nevertheless, there are two 'features' that strongly surprise me. > > How to use options in Grid is well documentated. With the option > Spacings it is very easy to obtain that no spacing will be used at the > edge of the grid, i.e. before the first and behind the last column, > above the first row and below the last row, so I cannot find any reason > for the following behaviour. > > For a nice application I needed a spacing at the edge of the grid and I > discovered that spacing at the edge is impossible if there is not a line > placed by the option Dividers or by the option Frame. Otherwise stated: > the effect of the option Spacings depends on the setting of the options > Dividers or Frame. A very unpleasant situation, not in line with the > high standards of Mathematica. > > Here is an example, where the option Spacings is used before the first > column, between the first and second column and behind the last column, > and similarly for the rows. > > mat = Array[ Style[RandomChoice[{"a", "aa", "aaa"}] , Background -> > GrayLevel[0.8], FontSize -> 20] &, {4, 4}]; > > Manipulate[ > Grid[mat, Dividers -> div, > Spacings -> {{sp1, sp1, {0}, sp1}, {sp2, sp2, {0}, sp2}}, Background > -> Yellow], > {{sp1, 2, "Column spacing"}, 0, 10}, {{sp2, 2, "Row spacing"}, 0, 10}, > {{div, All, "Dividers"}, {None, Center, All, {-1 -> True}}} ] > > A much less important observation is that the option Frame does not have > any effect when the option Dividers is in the Grid command, even if the > right-hand side of the option Dividers is the default value. So Dividers > and Frame cannot be used at the same time. Here is the example to play with: > > Manipulate[ > Grid[mat, Spacings -> {3, 3}, Frame -> fr, Background -> Yellow, > If[divopt, Options[Grid, Dividers][[1]], Sequence @@ {}] ], > {{fr, None, "Frame"}, {None, {2 -> True}, {{2 -> True}, {1 -> True}}, > {None, None, {1, 2} -> True}}}, > {{divopt, False, "Option Dividers "}, {True, False}} ] > > Fred Simons > Eindhoven University of Technology > > >