3
$\begingroup$

Here's an example of the problem, say you have a Grid with particular spacings that looks like this:

disk = Graphics[Disk[], ImageSize -> 10];
opts = {Alignment -> Right, Spacings -> {{0.5, {0.5, 0.5, 0.5, 2}}, .5}};
grid = {If[Mod[#, 4] == 0, ToString@#, ""] & /@ Range[12], Table[disk, 12]};
Grid[grid, BaseStyle -> 10, Sequence @@ opts]

enter image description here

You may want to increase the text size a little, however, this changes the spacing which is not desired:

Grid[grid, BaseStyle -> 30, Sequence @@ opts]

enter image description here

I'd like to keep both the size and spacing of dots the same (it's ok for text to extend left over multiple dots). This rules out using ItemSize -> All:

Grid[grid, ItemSize -> All, Dividers -> All, BaseStyle -> 30, Sequence @@ opts]

enter image description here

I'm pretty sure there's an easy trick to doing this. Note: Magnify does not work for me because it won’t preserve my settings when Exported.

$\endgroup$

2 Answers 2

4
$\begingroup$
  1. Since Spacings are in units of current font size, we need to adjust the vertical spacings when font size is changed.

  2. We can modify the first row to make use of SpanFromLeft to allow content to extend multiple cells to the left.

grid2 = {If[Mod[#, 4] == 3, ToString@(# + 1), 
     If[Mod[#, 4] == 0, SpanFromLeft, ""]] & /@ Range[12], 
  Table[disk, 12]}

Grid[grid2, BaseStyle -> 30, 
 Spacings -> {{0.5 , {0.5, 0.5, .5, 2}}, .5/12}, Alignment -> Right]

enter image description here

$\endgroup$
0
$\begingroup$
g = Grid[grid, BaseStyle -> 10, Sequence @@ opts]
Magnify[g, 2]
$\endgroup$
1
  • $\begingroup$ I can’t use magnify $\endgroup$
    – M.R.
    Dec 11, 2020 at 5:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.