1
$\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$

1 Answer 1

6
$\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$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.