Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: RE: Integration of very simple partwise defined functions fails
  • Next by Date: Re: List Position
  • Previous by thread: Re: BracketingBar for output
  • Next by thread: Re: BracketingBar for output