# How to change alignment of Grid/Matrix created using menu (Insert->Matrix/Table->New)

When I create a Grid using the menu, as follows:

and then start to add data, I'd like to make the alignment to be left and not center which is the default

There is no option to change this when creating new Grid as one can see:

If I try to change the alignment in code by making new variable like this

   data2 = Grid[data, Frame -> All, Alignment -> Left]


and then use data2 from now on, I find it is no longer possible to add rows/columns to data2.

Question: How to control alignment of Grid/Matrix when it is created using the menu? Is there a way to do that afterwords while keeping the functionality of adding rows/column?

I am using V9 on windows 7.

update

adding a row, after making new copy with correct alignment, does actually work. The cursor has to be on the row itself, and not outside, and not by selecting the whole grid. This screen shot shows the correct way. Again, make sure the cursor is inside the grid, at the row where the new row needs to be inserted.

Update 12/27/12

Just wanted to point out the difference between making a Grid using the menu, vs. the command Grid.

When using the menu to create a Grid, the data added to the Grid can be access as a matrix, directly. But when creating the Grid in code using the command itself, the data is wrapped by the Grid, and one needs an extra dimension to access the data. This picture explains:

So, this shows that it would have been better to be able to make the Grid using the menu. But becuase it is missing the alignment option, one has to use the command itself, but then one must remember to add the extra dimension now each time.

• The short-cuts Ctrl+Enter to add rows and Ctrl+, to add columns don't work? – kglr Dec 27 '12 at 17:12
• If I select the bottom right placeholder (from your update) and then hit ctrl-comma I get an extra column. Problem solved? – Sjoerd C. de Vries Dec 27 '12 at 20:08
• @Nasser, just noticed a number of updates to your post. Hope the answer i just posted addresses most of them. – kglr Dec 28 '12 at 13:00

If you are not specifically set on creating an input grid using the Insert menu you can manually create the Box form that you want, including whatever alignment parameters you require. For example:

grid[dims__] :=
Cell[BoxData[GridBox[
ConstantArray["\[Placeholder]", {dims}],
GridBoxAlignment -> {"Columns" -> {{Left}}}
]], "Input"] // CellPrint


Use:

grid[2, 3]


And after entering values: