Re: format Text in graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg42268] Re: format Text in graphics
- From: Murray Eisenberg <murraye at attbi.com>
- Date: Thu, 26 Jun 2003 05:36:23 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <bdbre2$400$1@smc.vnet.net>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
That _almost_ works: the one thing that causes trouble is that if y already has a value, say y = 0; then what is printed by the Epilog is 0 = f(x) albeit in proper conventional math notation (with the f and x italicized but the 0, equal sign, and parentheses upright). So it would seem necessary to wrap the whole thing in a Block. Still, this woud break down if, in some part of the Plot expression, one actually had to assign a value of the symbol y. Surely there must be some robust way of doing what I asked -- with all the symbols in y = f(x) being treated as pure text to be formatted. In fact, I'm beginning to be in disbelief that there's no simple and robust way to accomplish what I asked, which seems such an obvious thing to want! Gianluca Gorni wrote: > Hello! > > I do it this way: > > Format[myEqual[x_, y_], TraditionalForm] := > DisplayForm[RowBox[{x, "=", y}]]; > > Plot[Sin[x], {x, 0, 2Pi}, > Epilog -> {Text[TraditionalForm[myEqual[y, f[x]]], {Pi, 1/2}]}]; > > Good luck, > > Gianluca Gorni > > >>From: Murray Eisenberg <murray at math.umass.edu> To: mathgroup at smc.vnet.net >>Organization: Mathematics & Statistics, Univ. of Mass./Amherst >>Reply-To: murray at math.umass.edu >>Date: Wed, 25 Jun 2003 01:53:47 -0400 (EDT) >>To: mathgroup at smc.vnet.net >>Subject: [mg42268] format Text in graphics >> >>What value of Epilog in a Plot expression will properly format >> >>y = f(x) >> >>in conventional mathematical style? That is, the y, f, and x should be >>italicized but the = and parentheses should not. >> >>Some things that do NOT work: >> >>Epilog -> Text[TraditionalForm[y = f(x)], {0.5, 0.5}] >> >>(* that just sets y to be f(x) and then displays f(x) *) >> >>textForm[txt_] := StyleForm[txt, FontFamily -> Times] >>mathForm[txt_] := StyleForm[txt, FontFamily -> Times, FontSlant -> Italic] >> >>Epilog -> Text[mathForm["y "], textForm["="], mathForm[" f(x)"], {0.5 0.5}] >> >>(* SOMETHING like the preceding should work, but I don't see how to >>combine the three StyleForm results *) >> >>-- >>Reply to "REPLY TO" address and NOT to the "FROM" address!! >>Otherwise I will never see your reply!!!!!!!!!!!!!!!!!!!!!! >> >>Murray Eisenberg murray at math.umass.edu >>Mathematics & Statistics Dept. >>Lederle Graduate Research Tower phone 413 549-1020 (H) >>University of Massachusetts 413 545-2859 (W) >>710 North Pleasant Street fax 413 545-1801 >>Amherst, MA 01003-9305 >> > > -- Reply to "REPLY TO" address and NOT to the "FROM" address!! Otherwise I will never see your reply!!!!!!!!!!!!!!!!!!!!!! Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305