# How to make the default table alignment “right”

The default table alignment is Center, however I would like to make it Right so that MatrixForm by default returns a matrix with right-aligned entries. I have played around with the options inspector setting the option Alignment(TableViewBoxOptions) to {Right, Bottom},

but it does not seem to produce any effect. Also, I noticed a button Apply in the options Inspector window, which is greyed and inactive??

-

Within a session this should work:

SetOptions[MatrixForm, TableAlignments -> Right]


You can make this setting global and persistent by including it in your user init.m file. This file is loaded by each Kernel as it is started. You can find its location by evaluating:

FileNameJoin[{\$UserBaseDirectory, "kernel", "init.m"}]


Please make a back-up of this file before modifying it. For more see: Automatically load packages at startup and init.m documentation

TableForm, MatrixForm, and Grid use GridBox, but GridBoxOptions will be overruled by the individual Options of these formatting functions.

I believe that TableViewBox (along with GridBox) is used by the undocumented TableView:

 Array[Times, {5, 5}] // TableView


Also be aware that there is (or was) a bug in TableForm: TableAlignments -> Left not working

-
Thanks you for the answer. I did not think of this alternative, and this will probably be sufficient for me. However, I am still intrigued by the question of how to make this the default behaviour globally, not just for a session or for a notebook. Thanks again. –  Emilio Faro Dec 22 '13 at 11:53
@Emilio I'll update my answer with more specific instruction. –  Mr.Wizard Dec 22 '13 at 11:56