RowSpacings allows one to change row spacings in a Grid.
Help says:
RowSpacings->{Subscript[s, 12],Subscript[s, 23],...} can be used to specify
different spacings between different rows. If there are more rows than
entries in this list, then the last element of the list is used repeatedly
for the remaining rows
Notice, where it says the remaining rows above.
What I want is to make all starting rows use some spacing, but the last row to use different spacing.
This example does the documented way (the remaining rows)
n = 5;
data = Table[Random[], {n}, {n}];
Grid[data, Frame -> All, RowSpacings -> {6, 1}, Alignment -> Center]

But I wanted to do the reverse, i.e. set the last row to something, and all rows before it to another. Only way I could do it is the long way, i.e. by writing down all the spacings for all the rows until the last one:
n = 5;
data = Table[Random[], {n}, {n}];
Grid[data, Frame -> All,
RowSpacings -> {Sequence @@ Table[1, {n - 2}], 6},Alignment -> Center]

The above is just another way to write
Grid[data, Frame -> All, RowSpacings -> {1, 1, 1, 6}, Alignment -> Center]
I also tried things like
Grid[data, Frame -> All, RowSpacings -> {{1}, 6}, Alignment -> Center]
Grid[data, Frame -> All, RowSpacings -> {{1 ;; 3}, 6}, Alignment -> Center]
but they do not work. I could not find a short cut like in the first example above.
Any one knows a trick to tell RowSpacings to set only the last Row to some specific value, and all rows up to it to some other one, without the use of the above hack?
This is not a big deal really to do it as I did, I just was wondering if I am overlooking one of those trick syntax usage in Mathematica, that is all.
thanks,
Assuming you don’t have other reasons to use
RowSpacings+GridBoxcombination, usingSpacingsoption forGridgives what you need.
EDIT: More conveniently,
Grid[data, Spacings -> {Automatic, -2-> 6}, Frame -> All, Alignment -> Center]where-2refers to the second from last element of the row indices that go from 1 to1+number of rowsEDIT 2: Using
GridBox, the following produces the same output: