3
$\begingroup$

I'm trying to lay-out a Grid with various entry-specific Frame settings. In my case, using Item[...,Frame->...] just simplifies the code compared to using Grid[...,Frame->{Automatic,Automatic,{{{a,b},{c,d}}->...} with a long list of rules.

However, my grid includes some SpanFromLeft elements, too. In a Grid containing both the noted Items and SpanFromLefts, it seems that only some options from Item are inherited by the SpanFromLeft cells. For example, Background gets inherited, but Frame does not.

Does anyone know why this is, and whether it is a bug, and whether there are any workarounds other than the one I noted (as wanting to avoid)?

Here is an example:

Grid@{{Item[a, Frame -> All, Background -> Red], SpanFromLeft, 
   Item[b, Frame -> All, Background -> Red]}, {c, d, SpanFromAbove}}

Output:Grid formatting with Item and SpanFromLeft

$\endgroup$
5
  • $\begingroup$ looks like a version and/or os issue. Your code works as expected in version 13.1.0 (Linux x86 - 64-bit). $\endgroup$
    – kglr
    Commented Feb 25, 2023 at 21:43
  • $\begingroup$ @kglr On your machine, could you evaluate CurrentValue[SelectedNotebook[], {GridBoxOptions, GridBoxDividers}] and give the result please ? Thanks $\endgroup$
    – andre314
    Commented Feb 25, 2023 at 21:45
  • $\begingroup$ The result I get is {} $\endgroup$
    – kglr
    Commented Feb 25, 2023 at 21:48
  • $\begingroup$ OK. So it seems effectively to be version or OS dependent. On my machine (Window 7, Mma Version 12.2) I obtain the same result as the OP, with CurrentValue[SelectedNotebook[], {GridBoxOptions, GridBoxDividers}] returning {}. $\endgroup$
    – andre314
    Commented Feb 25, 2023 at 21:59
  • $\begingroup$ I also get {}. I'm running Mac OS X 13.2 with Mathematica 12.2. $\endgroup$
    – Sean
    Commented Feb 26, 2023 at 4:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.