0
$\begingroup$

This is a simple question, but I just cannot understand the explanation given in the Grid documentation page for how to set different alignments for different parts of a grid. I have a grid with two rows with four columns each, and I would like the top row to be bottom aligned and the bottom row to be top aligned. Or, in general, I want to specify one alignment per row (again, for a two row grid). How do I do this?

$\endgroup$
5
$\begingroup$
mat = {{Column[{12, 34}], 123, 1234, 5}, {Column[{1, 2}], 3, 4, 5}};

The default is center aligned rows and columns

mat // Grid[#, Frame -> All] &

enter image description here

For top row to be bottom aligned and the bottom row to be top aligned

mat // Grid[#, Frame -> All,
   Alignment -> {Automatic, {Bottom, Top}}] &

enter image description here

You can specify any desired Alignment

mat // Grid[#, Frame -> All,
   Alignment -> {{Center, Left, Right, Center}, {Bottom, Top}}] &

enter image description here

$\endgroup$

Your Answer

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

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