Hi

On 4/27/07, Gert Ingold <[EMAIL PROTECTED]> wrote:
> The reason for this behavior is that the labels are set in mathmode. If
> you do not own Helvetica math fonts (as is the case for most of us, I guess)
> you have to instruct PyX not to typeset labels in mathmode by specifying
> the axis texter as follows:
>
>   texter=graph.axis.texter.decimal(labelattrs=[])
>

That is sort of OK for the example he gives, but if the axis range
extends to negative values then the minus signs will not come out
right....

The question is really a LaTeX question first of all: "How do I get
sans serif math fonts?"

As far as I know, the only answer that currently works with PyX is
sfmath.sty (http://dtrx.de/od/tex/sfmath.html)

Here is an example of its use in PyX:

################################################################
from pyx import *
text.set(mode="latex")
text.preamble(r"\usepackage{sfmath}")
text.preamble(r"\renewcommand{\familydefault}{\sfdefault}")
xtitle = r"""
Here is some math:
$a \times b \times c$, $2.7\times10^{22}$, $\int f(\alpha)\,d\alpha$
"""
ytitle = r"This is the $y$ axis"
g = graph.graphxy(width=10,
                  x=graph.axis.lin(title=xtitle),
                  y=graph.axis.lin(title=ytitle),
                  key=graph.key.key())
f = graph.data.function("y(x) = (sin(x)/x)",
                        min=-10, max=10,
                        title=r"$y(x) = (\sin x)/x$")
g.plot(f)
g.writePDFfile("pyx-font-test.pdf")
################################################################

The example uses the CM fonts, but you can also use helvetica, etc -
see the documentation.

In priniciple, better results would come from using a font that was
designed from the ground up to have sans serif math characters. For
example, cmbright.sty or arev.sty. However, my experience has been
that these don't work with PyX. See the bug report that I sent to the
list a few days back concerning Arev.

Cheers

Will

--

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to