Skip to main content
3 of 7
edited tags
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

Grid - problem with ItemSize being ignored

I have run into another problem with Grid today.
An explicitly specified ItemSize is being ignored:

dot = Graphics[{Pink, Disk[]}, ImageSize -> 40];

tab = {{"Type", "Name", \[SpanFromLeft], \[SpanFromLeft], 
    Item[dot, ItemSize -> 2.7], 
    Item["Esculap", 
     Alignment -> 
      Left], \[SpanFromLeft], \[SpanFromLeft]}, {\[SpanFromAbove], 
    "Dia.", "Spec", \[SpanFromLeft], \[SpanFromAbove], 
    Item[8.3 "mm", ItemSize -> {3.5, 2.7}, Alignment -> Right], 
    Item[11, Alignment -> Right], "6.3"}, {Item[dot, ItemSize -> 2.7],
     Item["Flycatcher", 
     Alignment -> Left], \[SpanFromLeft], \[SpanFromLeft], 
    Item[dot, ItemSize -> 2.7], 
    Item["Apus", 
     Alignment -> 
      Left], \[SpanFromLeft], \[SpanFromLeft]}, {\[SpanFromAbove], 
    Item[6.9 "mm", ItemSize -> {3.5, 2.7}, Alignment -> Right], 
    Item[17, Alignment -> Right], "9.8", \[SpanFromAbove], 
    Item[7.8 "mm", ItemSize -> {3.5, 2.7}, Alignment -> Right], 
    Item[8, Alignment -> Right], "6.7"}};

Grid[tab,
 Spacings -> {Automatic, {{0, -1.1}}},
 Alignment -> {Center, Center},
 Dividers -> All
]

Mathematica graphics

Please note Item[8.3 "mm", ItemSize -> {3.5, 2.7}, Alignment -> Right] where a vertical ItemSize is explicitly specified, yet it is ignored in the layout.

If the "Spec" cell is not spanned this does not happen:

tab[[2, 4]] = "X";

Grid[tab,
 Spacings -> {Automatic, {{0, -1.1}}},
 Alignment -> {Center, Center},
 Dividers -> All
]

Mathematica graphics

  • Is this another bug in Grid?

  • Is it still present in version 8?

  • How can I best work around it?

Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k