Re: Formated output
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1659] Re: [mg1531] Formated output
- From: Allan Hayes <hay%haystack at christensen.cybernetics.net>
- Date: Tue, 11 Jul 1995 03:17:09 -0400
Bengt Mansson <bengtmn at algonet.se>
in [mg1531] Formated output
wrote
>How can I get formated output from Mathematica, e g normal
integral > signs.
Bengt:
I guess that we are all waiting for the next version of Mma so that
we can do this sort of thing properly. Meanwhile here is something
that I have used while waiting.
(int is a dummy non-evaluating integral
You can remove the special version for the Mac if yu don't like the
small integral sign provided in the Courier font)
intsign =
If[$MachineType === "Macintosh", FromCharacterCode[186],
ColumnForm[{" /","|","|","/ "},Left, Center]
];
Format[int[f_,x_]]:= SequenceForm[ intsign, f," d",x ];
Format[int[f_,{x_,a_:" ",b_}]]:=
SequenceForm[
intsign," ",
ColumnForm[{Superscript[b]," "," ",Subscript[a]},Left,Center],
" ",f," d",x
];
Unprotect[Integrate];
Format[Integrate[f_,x_]]:= SequenceForm[intsign, f," d",x ];
Format[Integrate[f_,{x_,a_:" ",b_}]]:=
SequenceForm[
intsign," ",
ColumnForm[ {Superscript[b]," "," ",Subscript[a]},Left,Center],
" ",f," d",x
];
Protect[Integrate];
Examples
int[h[x],{x,a,b}]
/ b
| h[x] dx
|
/ a
Integrate[h[x],{x,a,b}]
/ b
| h[x] dx
|
/ a
Allan Hayes
hay at haystack.demon.co.uk