Let's consider a simple example

Grid[{ConstantArray[0, 5]}, Frame -> All, ItemSize -> {3, 3}, 
 Alignment -> {0.5, 0.5}]

According to the documentation of Alignment,

{x,y} aligned at horizontal and vertical positions x and y from -1 to +1

but in practice, the values of positions in Alignment don't change anything.

Am I missing something, or it is a bug? If latter, what are workarounds? Mathematica 11.3


Wolfram support confirmed this is unintended behavior.

  • 1
    $\begingroup$ Try Alignment -> {Center, Center}. Hope it helps. $\endgroup$ – Alexei Boulbitch Feb 26 '19 at 11:51
  • $\begingroup$ @AlexeiBoulbitch The problem with that is that you can't fine-tune the alignment, you only get a few predefined positions. $\endgroup$ – Lukas Lang Feb 26 '19 at 12:21
  • 2
    $\begingroup$ I think this specific syntax may not be supported in Grid. It does work in Panel, but not in Grid. $\endgroup$ – Szabolcs Feb 26 '19 at 12:39
  • $\begingroup$ AlexeiBoulbitch, Unfortunately, I need to be able to use specific coordinates. Szabolcs, It seems so, though it is not documented. $\endgroup$ – Ihor Feb 26 '19 at 13:16
  • 2
    $\begingroup$ I do not have time to write an answer but I believe using Framed on every Grid item will be a good workaround. Someone can expand this into an answer: Framed["foobar", ImageSize -> {100, 60}, Alignment -> {0.2, -0.5}, FrameStyle -> None, FrameMargins -> None] $\endgroup$ – Szabolcs Feb 26 '19 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.