Re: SetOptions with Column
- To: mathgroup at smc.vnet.net
- Subject: [mg64522] Re: SetOptions with Column
- From: Cca <cca at gregosetroianos.mat.br>
- Date: Mon, 20 Feb 2006 06:30:00 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
David Park wrote:
>Generally I wouldn't think it is worth detailed formatting of a GridBox for
>a homework assignment.
Rob,
You are RIGHT in your use of a vertical GridBox for equations with equal signs properly aligned. This is the NATURAL thing to do. I do this in Mathematica for teaching and I used this in LaTex many years ago. This is common in typesetting.
You have to set the ColumnAlignments suboption of GridBoxOptions:
GridBoxOptions->{ColumnAlignments->{"="}}
However, the solution below also works for grids with the "normal" = (the infix for Set):
GridBoxOptions->{ColumnAlignments->{"\[LongEqual]"}}
LongEqual (ESC+l=+ESC) has the advantage that it is interpreted as Equal (and not as Set). Did you know that? If I´m not mistaken, LongEqual appeared in Mathematica 5.0. Also, it seems that historically the equal sign was more close to LongEqual! (See http://members.aol.com/jeff570/mathword.html)
Using the Option Inspector, you can set this option at many levels: on a specific grid (that you must select), on a whole cell or for all cells in your notebook. Below I give you a button to make this even easier:
ButtonBox["AlignEqualSign",
ButtonFunction:>
Module[{nb},nb=InputNotebook[];SelectionMove[nb,All,Cell];
(*begin here*)
SetOptions[NotebookSelection[nb],
GridBoxOptions->{ColumnAlignments->{"\[LongEqual]"}}]],
(*end here*)
ButtonEvaluator->Automatic,Active->True]
(By the way, one can make MIRACLES with Mathematica buttons and palettes!! And I´ll will look forward to even better possibilities with Mathematica 6.)
Use DisplayForm to generate the button (although I have anoter button that do this more quickly). You can drop the
SelectionMove[nb,All,Cell]
to get a more flexible solution.
Hope this helps.
Carlos César de Araújo
Gregos & Troianos Educacional
www.gregosetroianos.mat.br
Belo Horizonte, MG, Brasil
(31) 3283-1122