Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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}, enter image description here

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??

share|improve this question
add comment

1 Answer

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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