[EMAIL PROTECTED] wrote: > Hi, > > I have different questions to use tex with matplotlib. > > The first one: > > If I'm doing: > > rc('text', usetex=True) > xlabel('$\textrm{toto}$') # bad > xlabel(r'$\textrm{toto}$') # ok > > The results are not the same and I don't understand why. > > and for: > > xlabel('$\textit{toto}$') #bad > xlabel(r'$\textit{toto}$') #ok > > same things, but it's working fine for: > > xlabel('$\it{toto}$') #ok > xlabel(r'$\it{toto}$') #ok > > but it's not working for \bf: > > xlabel('$\textbf{toto}$') # bad > xlabel(r'$\textbf{toto}$') # ok > xlabel('$\bf{toto}$') # bad > xlabel(r'$\bf{toto}$') # ok > > And this bring to the second question, I would like to create the xlabel with > latex stuf inside somewhere in my script: > > label='$\textrm{test}_2$' > > but that can't work: > > xlabel(label) # bad > > How to tell that I want the "r" before the chains to have TeX working like > expected?
I think you have much to gain and nothing to lose by *always* using raw strings for TeX. The reason your "bad" cases are bad is that \b and \t are escape sequences; in an ordinary string, without the leading r, the two-character sequences are translated into control characters (bell and tab, respectively). \i is not an escape sequence, so it gets left alone. Eric ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users