Re: Abs[ ] traditional form
- To: mathgroup at smc.vnet.net
- Subject: [mg60212] Re: Abs[ ] traditional form
- From: Cca <cca at gregosetroianos.mat.br>
- Date: Wed, 7 Sep 2005 04:04:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Eduardo,
Evaluate
Abs[x]//TraditionalForm
and press Shift+Ctrl+E to see the textual form of the output cell.
Next, select the operator names
\[LeftBracketingBar], \[RightBracketingBar]
and press F1 to get information from the Help Browser. You will see that
the corresponding aliases are Esc+l|+Esc and Esc+r|+Esc, respectively.
You can also:
(1) create your own alias for a whole notation.
(2) put everything in a paste button.
(More on the SEMANTICS below.)
For example, after evaluating the following expression, you can type just Esc+abs+Esc
to get the two vertical bars:
SetOptions[InputNotebook[],
InputAliases->
Append[Options[InputNotebook[],InputAliases][[1,2]],
"abs":>
RowBox[{"\[LeftBracketingBar]",\[SelectionPlaceholder],
"\[RightBracketingBar]"}]]]
And here goes a button:
ButtonBox[
(*button face*)
StyleBox[
FormBox[RowBox[{"\[LeftBracketingBar]","\[SelectionPlaceholder]",
"\[RightBracketingBar]"}],"TraditionalForm"],
FontFamily->"Times"],
(*notation to be pasted*)
ButtonData:>RowBox[{"\[LeftBracketingBar]","\[SelectionPlaceholder]",
"\[RightBracketingBar]"}]] // DisplayForm
Finally, it is important to note that a box expression like
RowBox[{"\[LeftBracketingBar]","x","\[RightBracketingBar]"}]
is interpreted as BracketingBar[x] in StandardForm. In a TraditionaForm cell, it
is interpreted as Abs[x]. As before, there are many ways to proceed here:
(4) set the intended meaning globally with BracketingBar=Abs;
(5) use MakeExpression to set a global meaning without affecting BracketingBar:
MakeExpression[RowBox[{"\[LeftBracketingBar]",x_,"\[RightBracketingBar]"}],
form_]:=MakeExpression[RowBox[{"Abs","[",x,"]"}],form]
(6) attach a LOCAL interpretation using InerpretationBox, TagBox or InterpretTemplate.
Thus, above you can replace all the occurrences of
RowBox[{"\[LeftBracketingBar]","\[SelectionPlaceholder]",
"\[RightBracketingBar]"}]
by
TagBox[RowBox[{"\[LeftBracketingBar]", "\[SelectionPlaceholder]",
"\[RightBracketingBar]"}], Abs @@ # &]
or
TagBox[
RowBox[{"\[LeftBracketingBar]",
TagBox["\[SelectionPlaceholder]"
Identity, Editable -> True], "\[RightBracketingBar]"}],
InterpretTemplate[Abs[#1] &],
Editable -> False]
Carlos César de Araújo
Gregos & Troianos Educacional
www.gregosetroianos.mat.br
Belo Horizonte, MG, Brasil
(31) 3283-1122