## Re: [PyX-user] LaTeX Labels

 Re: [PyX-user] LaTeX Labels From: Dan Reinholz - 2008-07-18 14:58:13 Solved the problem perfectly. Thanks! I just wanted to say thank you to everyone on the PyX mailings lists for being so incredibly responsive and helpful. It has made my entire user experience so much more wonderful, and I am confident I would've never been able to figure out half of my problems without your help. : ) --- William Henney wrote: > Hi Dan > > On Fri, Jul 18, 2008 at 8:11 AM, Dan Reinholz > wrote: > > Unfortunately, I wasn't able to use the same trick > for > > including a fraction as a title. Using the code: > > > > You need the following line near the top of your > code > > text.set(mode='latex') > > Otherwise, PyX uses plain TeX, which does not define > the \frac command > > HTH > > Will > > > -- > > Dr William Henney, Centro de Radioastronomï¿½a y > Astrofï¿½sica, > Universidad Nacional Autï¿½noma de Mï¿½xico, Campus > Morelia > 

 Re: [PyX-user] LaTeX Labels From: Dan Reinholz - 2008-07-18 13:11:43 Dear Alan, Thanks for your quick response. That cleared things up perfectly with the Greek letters. I guess it just goes to show my ignorance of Python. :) Unfortunately, I wasn't able to use the same trick for including a fraction as a title. Using the code: from pyx import * from pyx.graph import axis g = graph.graphxy(width=8, x=axis.linear(min=1, max=10, title=r"$\tau$"), y=axis.linear(title=r"$\frac{1}{2}$")) g.plot(graph.data.function("y(x)=sqrt(0.5*x)/(sqrt(0.5*x)+x)",points=500)) g.finish() g.writeEPSfile("derivatives_opt_2") I get the error: bsd% python derivatives_opt_2.py Traceback (most recent call last): File "derivatives_opt_2.py", line 11, in g.finish() File "/usr/local/lib/python2.5/site-packages/pyx/graph/graph.py", line 268, in finish self.doaxes() File "/usr/local/lib/python2.5/site-packages/pyx/graph/graph.py", line 491, in doaxes self.dolayout() File "/usr/local/lib/python2.5/site-packages/pyx/graph/graph.py", line 475, in dolayout self.doaxiscreate(axisname) File "/usr/local/lib/python2.5/site-packages/pyx/graph/graph.py", line 216, in doaxiscreate self.axes[axisname].create() File "/usr/local/lib/python2.5/site-packages/pyx/graph/axis/axis.py", line 565, in create self.canvas = self.axis.create(self.data, self.positioner, self.graphtexrunner, self.errorname) File "/usr/local/lib/python2.5/site-packages/pyx/graph/axis/axis.py", line 228, in create return _regularaxis._create(self, data, positioner, graphtexrunner, self.parter, self.rater, errorname) File "/usr/local/lib/python2.5/site-packages/pyx/graph/axis/axis.py", line 198, in _create variants[0].storedcanvas = layout(variants[0]) File "/usr/local/lib/python2.5/site-packages/pyx/graph/axis/axis.py", line 133, in layout self.painter.paint(canvas, data, self, positioner) return self.insert(self.texrunner.text_pt(x, y, atext, *args)) File "/usr/local/lib/python2.5/site-packages/pyx/text.py", line 1222, in text_pt return self.text(x * unit.t_pt, y * unit.t_pt, expr, *args, **kwargs) File "/usr/local/lib/python2.5/site-packages/pyx/text.py", line 1199, in text self.execute(expr, self.defaulttexmessagesdefaultrun + self.texmessagesdefaultrun + texmessages) File "/usr/local/lib/python2.5/site-packages/pyx/text.py", line 1036, in execute raise TexResultError("unhandled TeX response (might be an error)", self) pyx.text.TexResultError: unhandled TeX response (might be an error) The expression passed to TeX was: \ProcessPyXBox{\setbox0\hbox{$\vcenter{\vrule width0pt}$}\PyXDimenVShift=\ht0\setbox0\hbox{{\gdef\PyXBoxHAlign{0.50000}\gdef\PyXFlushHAlign{0.50000}\PyXragged{}$\frac{1}{2}$}}\lower\PyXDimenVShift\box0% }{8}% \PyXInput{12}% After parsing the return message from TeX, the following was left: * *! Undefined control sequence. \frac ...HAlign {0.50000}\PyXragged {}$\frac (cut after 5 lines, increase errordebug for more output) Is there any possible fix to use a fraction in my title, or do I need to seek an alternative formatting option? Thanks again, -Daniel ----------------- Message: 6 Date: Thu, 17 Jul 2008 19:00:13 -0400 From: Alan G Isaac Subject: Re: [PyX-user] LaTeX Labels To: pyx-user@... Message-ID: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII On Thu, 17 Jul 2008, Dan Reinholz apparently wrote: > title="$\tau\$" Use raw strings: http://docs.python.org/tut/node5.html#SECTION005120000000000000000 Cheers, Alan Isaac 
 Re: [PyX-user] LaTeX Labels From: William Henney - 2008-07-18 13:17:44 Ooops. Used the wrong from address. Try again. ---------- Forwarded message ---------- From: Date: Fri, Jul 18, 2008 at 8:15 AM Subject: Re: [PyX-user] LaTeX Labels To: whenney@... You are not allowed to post to this mailing list, and your message has been automatically rejected. If you think that your messages are being rejected in error, contact the mailing list owner at pyx-user-owner@... ---------- Forwarded message ---------- From: "William Henney" To: "Dan Reinholz" Date: Fri, 18 Jul 2008 08:15:42 -0500 Subject: Re: [PyX-user] LaTeX Labels Hi Dan On Fri, Jul 18, 2008 at 8:11 AM, Dan Reinholz wrote: > Unfortunately, I wasn't able to use the same trick for > including a fraction as a title. Using the code: > You need the following line near the top of your code text.set(mode='latex') Otherwise, PyX uses plain TeX, which does not define the \frac command HTH Will -- Dr William Henney, Centro de Radioastronomía y Astrofísica, Universidad Nacional Autónoma de México, Campus Morelia 
 Re: [PyX-user] LaTeX Labels From: Dan Reinholz - 2008-07-18 14:58:13 Solved the problem perfectly. Thanks! I just wanted to say thank you to everyone on the PyX mailings lists for being so incredibly responsive and helpful. It has made my entire user experience so much more wonderful, and I am confident I would've never been able to figure out half of my problems without your help. : ) --- William Henney wrote: > Hi Dan > > On Fri, Jul 18, 2008 at 8:11 AM, Dan Reinholz > wrote: > > Unfortunately, I wasn't able to use the same trick > for > > including a fraction as a title. Using the code: > > > > You need the following line near the top of your > code > > text.set(mode='latex') > > Otherwise, PyX uses plain TeX, which does not define > the \frac command > > HTH > > Will > > > -- > > Dr William Henney, Centro de Radioastronomï¿½a y > Astrofï¿½sica, > Universidad Nacional Autï¿½noma de Mï¿½xico, Campus > Morelia > 
 Re: [PyX-user] LaTeX Labels From: Alan G Isaac - 2008-07-18 13:19:24 On Fri, 18 Jul 2008, Dan Reinholz apparently wrote: > After parsing the return message from TeX, the > following was left: > * > *! Undefined control sequence. > \frac It looks like the default mode is to use plain tex macros and you are using a latex macro. http://pyx.sourceforge.net/manual/node24.html Either change modes or use 1 \over 2 instead of \frac12. hth, Alan Isaac PS Hey guys, how about calling the mode "plain" instead of "tex"?? That's just not nice! ;-)