4

As titled above, How I can justify and how I can change the space between columns in this Grid specified below:

m=4;   
x={1,2,3,4};
F = Table[i, {i, m}, {j, m - i + 1}]; 
head={"Subscript[x, i]","f(Subscript[x, i])"};
data=Table[0,{m+1}];
data[[1]]=Column[x];
For[i=2,i<=m,i++,
    data[[i]]=Column[F[[i-1]]];
  ];
Grid[Join[{head},{data}],Dividers->{3->Blue,2->Blue},Alignment->Right]

I want the space of elements to increase vertically, but by using the Spacing command it doesn't get increased; and by vertically align I mean for example the 2 number in the following to be aligned center vertically

Grid[{{1, 2, 3}, {4, SpanFromAbove, 6}, {7, 8, 9}}, Frame -> All]

This this what Mathematica gives to me

enter image description here

and this is what I want: (something like this) but according to my codes

enter image description here

I have displayed frames of elements for illustration purposes only below

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
NoMan
  • 121
  • 9

1 Answers1

3
    (*auxiliary functions*)
wrap = Function[item, Pane[item, {90, 90/GoldenRatio}, FrameMargins -> 0, 
                                 ImageMargins -> 0, Alignment -> Center]
                , Listable];

grid = Grid[#, Spacings -> {0, 0}, Alignment -> {Left, Center}] &;

    (*I don't know what you are doing so I'm making up data:*)
data = wrap@{{2 #, #}, {##2}} & @@ Table[ RandomInteger[{-10, 10}, i]/2, {i, 5, 1, -1}];

lbl = wrap @ {"x_i", "f(x_i)"};


Grid[{
  {grid[{lbl}], ""},
  {grid@Transpose@First@data, 
   grid[{grid[Transpose[{#}]] & /@ Last@data}]}
  }, Spacings -> {0, 0}, 
     Dividers -> {{2 -> {Blue, Thickness@5}}, {2 -> {Blue, Thick}}}, 
     BaseStyle -> {18, Bold, ScriptSizeMultipliers -> 1}]

enter image description here

I love grid.

Kuba
  • 136,707
  • 13
  • 279
  • 740