RE: BracketingBar for output
- To: mathgroup at smc.vnet.net
- Subject: [mg15768] RE: [mg15717] BracketingBar for output
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Sun, 7 Feb 1999 02:03:49 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Peter Breitfeld wrote: _______________ In my "personal package" I have the function Betrag[x_]:=Sqrt[x.x] Now I want that in cases where this function can't be evaluated, the output in StandardForm is displays as |x|. (left and right BracketingBar, these symbols you get when entering `ESC l| ESC' and `ESC r| ESC'. To make it more clear (I hope :-)) I want the following behavior In[1] Betrag[foo] Out[1] |foo| but In[1] Betrag[{2,2,1}] Out[1] 3 _________________________ This should do it. (***** Code Begins *******) Betrag[x_List]:=Sqrt[x.x]; MakeBoxes[Betrag[expr_],StandardForm]:= RowBox[{"\[LeftBracketingBar]", MakeBoxes[expr,StandardForm],"\[RightBracketingBar]" }] (****** Code Ends *******) Regards, Ted Ersek