MathGroup Archive 2008

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

Search the Archive

Re: display Floor in StandardForm


Peter Breitfeld wrote:

>In TraditionalForm Floor[x] is displayed as \[LeftFloor]x\[RightFloor]
>in both of the following cases
>
>(1) Evaluate Floor[x] then Output in pretty form
>(2) Entering Floor[x] in an InputCell an then Cell/Convert to
>    TraditionalForm
>
>Now I tried to mimic this behavior for StandardForm. I did
>
>Unprotect[Floor, Ceiling];
>Format[Floor[x_/;!NumericQ[x]], StandardForm] := 
>     DisplayForm[RowBox[{"\[LeftFloor]", x, "\[RightFloor]"}]]
>Protect[Floor];
>
>The case (1) above now works even with complicated expressions and
>lists, but case (2) replaces Floor[x] with DisplayForm[...]
>
>Is there a possibility to make it work as in TraditionalForm?
>
>TIA
>
>Gruss Peter
>  
>
Try:

MakeBoxes[Floor[x_], StandardForm] := RowBox[{"\[LeftFloor]", 
MakeBoxes[x, StandardForm], "\[RightFloor]"}]

Then, you can even do

esc lf esc x esc rf esc

where esc is the escape key to get Floor[x] in "StandardForm" without 
using Cell/Convert to StandardForm.

Carl Woll
Wolfram Research


  • Prev by Date: Re: How to plot discontinuous functions?
  • Next by Date: Re: display Floor in StandardForm
  • Previous by thread: Re: display Floor in StandardForm
  • Next by thread: Re: display Floor in StandardForm