|
From: Brett C. <br...@co...> - 2003-09-10 04:46:05
|
Hi, Is this lib supposed to work without problems on Windows? I have had to make a few hacks to get things going, but I'm not sure if this is cos' I have missed something. 1. kpathsea lib won't build. Is there anywhere I can get the appropriate files? 2. it reverts to kpsewhich, but on my machine (using MikTeX), this won't find the psfonts.map file. I hardcoded this in. Everything seems to run now, but : 3. fonts don't seem to be produced properly, prbly cos' my hack in 2 didn't work. 4. temporary .dvi files are left around the place. 5. Output in the eps files seems jammed in the bottom left corner (using ghostscript viewer) is this just a config problem?? Any help to fix these things would be great. Note that my latex knowledge is not huge, nor my postscript knowledge. Also -- how do I change the default font? Cheers, Brett |
|
From: Joerg L. <jo...@us...> - 2003-09-17 16:23:50
|
Hi Brett,
sorry for the delay, I was on holiday and André, too.
On 10.09.03, Brett Calcott wrote:
> Is this lib supposed to work without problems on Windows?
Yes, of course.
> I have had to make a few hacks to get things going, but I'm not sure if this
> is cos' I have missed something.
>
> 1. kpathsea lib won't build. Is there anywhere I can get the appropriate
> files?
You need the kpathsea header files, which probably are not included
in the MikTeX distribution. On the other hand, it's no major drawback
if you use the kpsewhich workaround.
> 2. it reverts to kpsewhich, but on my machine (using MikTeX), this won't
> find the psfonts.map file. I hardcoded this in.
This is a bug indeed, which already has been fixed in CVS.
> Everything seems to run now, but :
> 3. fonts don't seem to be produced properly, prbly cos' my hack in 2 didn't
> work.
Maybe this are the effects of another bug, which also has been fixed
in CVS. Btw, have you been able to build the t1strip c extension module?
> 4. temporary .dvi files are left around the place.
Is this always the case, or only if PyX exits with an exception?
> 5. Output in the eps files seems jammed in the bottom left corner (using
> ghostscript viewer) is this just a config problem??
This is normal behaviour of EPS files. However, if you don't like this,
use something like
c.writetofile(filename, paperformat="a4")
to shift the output to the centre of an a4 page.
> Also -- how do I change the default font?
For this, you have to use an appropriate LaTeX package (like times.sty).
Activate it with
text.preamble(r"\usepackage{times}")
right after the pyx imports. Please make sure that the necessary
Type 1 fonts are available in your psfonts.map.
Best regards,
Jörg
|
|
From: Brett C. <br...@co...> - 2003-09-18 12:48:19
|
>
> sorry for the delay, I was on holiday and Andr=E9, too.
Hope it was good!
>
> You need the kpathsea header files, which probably are not included
> in the MikTeX distribution. On the other hand, it's no major drawback
> if you use the kpsewhich workaround.
Is it not possible to include them in the distro?
>
> > 2. it reverts to kpsewhich, but on my machine (using MikTeX), this wo=
n't
> > find the psfonts.map file. I hardcoded this in.
>
> This is a bug indeed, which already has been fixed in CVS.
>
I got everything from CVS, installed it and I still get
X:\pyx\examples>python hello.py
Traceback (most recent call last):
File "hello.py", line 6, in ?
c.writetofile("hello")
File "c:\python23\Lib\site-packages\pyx\canvas.py", line 943, in
writetofile
pritem.write(file)
File "c:\python23\Lib\site-packages\pyx\prolog.py", line 123, in write
raise RuntimeError("cannot find type 1 font %s" % self.filename)
RuntimeError: cannot find type 1 font cmr10.pfb
This file is here:
c:\miktex\texmf\type1\bluesky\cm\cmr10.pfb
> > Everything seems to run now, but :
> > 3. fonts don't seem to be produced properly, prbly cos' my hack in 2
didn't
> > work.
>
> Maybe this are the effects of another bug, which also has been fixed
> in CVS. Btw, have you been able to build the t1strip c extension module=
?
tstrip builds fine. I have no idea what it does..
>
> > 4. temporary .dvi files are left around the place.
>
> Is this always the case, or only if PyX exits with an exception?
>
No, they get left around even if everything works.
> > 5. Output in the eps files seems jammed in the bottom left corner (us=
ing
> > ghostscript viewer) is this just a config problem??
>
> This is normal behaviour of EPS files. However, if you don't like this,
> use something like
>
> c.writetofile(filename, paperformat=3D"a4")
>
> to shift the output to the centre of an a4 page.
>
> > Also -- how do I change the default font?
>
> For this, you have to use an appropriate LaTeX package (like times.sty).
> Activate it with
>
> text.preamble(r"\usepackage{times}")
>
I use the mathpazo package (palatino with math) all the time.
I tried it in the hello.py example after the from pyx import *
X:\pyx\examples>python hello.py
Traceback (most recent call last):
File "hello.py", line 2, in ?
text.preamble(r"\usepackage{mathpazo}")
File "c:\python23\Lib\site-packages\pyx\text.py", line 2230, in preambl=
e
self.execute(expr, *args)
File "c:\python23\Lib\site-packages\pyx\text.py", line 2068, in execute
raise TexResultError("unhandled TeX response (might be an error)", se=
lf)
pyx.text.TexResultError: unhandled TeX response (might be an error)
The expression passed to TeX was:
\usepackage{mathpazo}%
\PyXInput{5}%
After parsing the return message from TeX, the following was left:
*! Undefined control sequence.
<*> \usepackage
{mathpazo}%
Sorry I can't be more helpful -- I don't know the internals of latex that
well.
Let me know if you need more info.
Brett
|
|
From: Joerg L. <jo...@us...> - 2003-09-18 13:08:29
|
Hi Brett,
On 18.09.03, Brett Calcott wrote:
> > You need the kpathsea header files, which probably are not included
> > in the MikTeX distribution. On the other hand, it's no major drawback
> > if you use the kpsewhich workaround.
>
> Is it not possible to include them in the distro?
Hmm, I don't think that makes much sense, they have to match
your distribution. However, I forget to mention that
you have to tell the setup.py script where it has to look for
the header and library files. This can be done
via a setup.cfg file (in the same directory as setup.py) which
contains
[build_ext]
include_dirs=path-to-your-MikTeX-include-files
library_dirs=path-to-your-MikTeX-library-filesa
> I got everything from CVS, installed it and I still get
>
> X:\pyx\examples>python hello.py
> Traceback (most recent call last):
> File "hello.py", line 6, in ?
> c.writetofile("hello")
> File "c:\python23\Lib\site-packages\pyx\canvas.py", line 943, in
> writetofile
> pritem.write(file)
> File "c:\python23\Lib\site-packages\pyx\prolog.py", line 123, in write
> raise RuntimeError("cannot find type 1 font %s" % self.filename)
> RuntimeError: cannot find type 1 font cmr10.pfb
>
> This file is here:
> c:\miktex\texmf\type1\bluesky\cm\cmr10.pfb
What is the output of "kpsewhich cmr10.pfb"?
> tstrip builds fine. I have no idea what it does..
t1strip implements the partial font downloading, that is
that only the glyphs that have been used are included in
the files. Otherwise the resulting EPS files become
rather huge.
> >
> > > 4. temporary .dvi files are left around the place.
> >
> > Is this always the case, or only if PyX exits with an exception?
> >
>
> No, they get left around even if everything works.
Hmm. What files precisely?
> I use the mathpazo package (palatino with math) all the time.
> I tried it in the hello.py example after the from pyx import *
>
>
> X:\pyx\examples>python hello.py
> Traceback (most recent call last):
> File "hello.py", line 2, in ?
> text.preamble(r"\usepackage{mathpazo}")
> File "c:\python23\Lib\site-packages\pyx\text.py", line 2230, in preamble
> self.execute(expr, *args)
> File "c:\python23\Lib\site-packages\pyx\text.py", line 2068, 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:
> \usepackage{mathpazo}%
> \PyXInput{5}%
> After parsing the return message from TeX, the following was left:
> *! Undefined control sequence.
> <*> \usepackage
> {mathpazo}%
Ah, you are in TeX mode, where \usepackage does not exist. Please
tell PyX to switch to LaTeX by including
text.set(mode="latex")
before the preamble line.
Regards,
Jörg
|
|
From: Brett C. <br...@co...> - 2003-09-19 20:15:37
|
> >
> > Is it not possible to include them in the distro?
>
> Hmm, I don't think that makes much sense, they have to match
> your distribution. However, I forget to mention that
> you have to tell the setup.py script where it has to look for
> the header and library files. This can be done
> via a setup.cfg file (in the same directory as setup.py) which
> contains
>
> [build_ext]
> include_dirs=path-to-your-MikTeX-include-files
> library_dirs=path-to-your-MikTeX-library-filesa
>
I got the whole Miktex distro -- I'll have a look at getting it going later.
It doesn't look like the includes & libs are the same as you have specified.
>
> > >
> > > > 4. temporary .dvi files are left around the place.
> > >
> > > Is this always the case, or only if PyX exits with an exception?
> > >
> >
> > No, they get left around even if everything works.
>
> Hmm. What files precisely?
Let me get back to you on this.
>
> > I use the mathpazo package (palatino with math) all the time.
> > I tried it in the hello.py example after the from pyx import *
> >
> >
> > X:\pyx\examples>python hello.py
> > Traceback (most recent call last):
> > File "hello.py", line 2, in ?
> > text.preamble(r"\usepackage{mathpazo}")
> > File "c:\python23\Lib\site-packages\pyx\text.py", line 2230, in
preamble
> > self.execute(expr, *args)
> > File "c:\python23\Lib\site-packages\pyx\text.py", line 2068, 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:
> > \usepackage{mathpazo}%
> > \PyXInput{5}%
> > After parsing the return message from TeX, the following was left:
> > *! Undefined control sequence.
> > <*> \usepackage
> > {mathpazo}%
>
> Ah, you are in TeX mode, where \usepackage does not exist. Please
> tell PyX to switch to LaTeX by including
>
> text.set(mode="latex")
>
Getting better, but still no luck. sorry, I just don't know the font stuff
in latex well enough to guess what is going on.
X:\pyx\examples>cat hello.py
from pyx import *
text.set(mode="latex")
text.preamble(r"\usepackage{times}")
c = canvas.canvas()
c.text(0, 0, "Hello, world!")
c.stroke(path.line(0, 0, 2, 0))
c.writetofile("hello")
X:\pyx\examples>python hello.py
Traceback (most recent call last):
File "hello.py", line 7, in ?
c.writetofile("hello")
File "c:\python23\Lib\site-packages\pyx\canvas.py", line 936, in
writetofile
for pritem in self.prolog():
File "c:\python23\Lib\site-packages\pyx\canvas.py", line 661, in prolog
result.extend(cmd.prolog())
File "c:\python23\lib\site-packages\pyx\text.py", line 1784, in prolog
return result + self.texrunner.prolog(self.dvinumber, self.page)
File "c:\python23\lib\site-packages\pyx\text.py", line 2090, in prolog
self.getdvi()
File "c:\python23\lib\site-packages\pyx\text.py", line 2084, in getdvi
self.dvifiles.append(DVIFile(dvifilename, debug=self.dvidebug))
File "c:\python23\lib\site-packages\pyx\text.py", line 689, in __init__
self.readfile()
File "c:\python23\lib\site-packages\pyx\text.py", line 1091, in readfile
state = self._read_page()
File "c:\python23\lib\site-packages\pyx\text.py", line 1049, in _read_page
file.read(file.readuchar()+file.readuchar()))
File "c:\python23\lib\site-packages\pyx\text.py", line 777, in definefont
self.fonts[num] = Font(fontname, c, q, d, self.tfmconv, self.debug > 1)
File "c:\python23\lib\site-packages\pyx\text.py", line 520, in __init__
raise RuntimeError("no information for font '%s' found in font mapping
file,
aborting" % name)
RuntimeError: no information for font 'ptmr7t' found in font mapping file,
abort
ing
If I look at the keys in 'fontmap' with 'pt', I only see these:
ptmb8r
ptmb8y
ptmbi8r
ptmbi8y
ptmbo8r
ptmbo8y
ptmr8r
ptmr8rn
ptmr8y
ptmri8r
ptmri8y
ptmro8r
ptmro8y
ptmrr8re
Cheers,
Brett
|
|
From: Joerg L. <jo...@us...> - 2003-09-19 20:09:24
|
Hi Brett,
On 19.09.03, Brett Calcott wrote:
> I got the whole Miktex distro -- I'll have a look at getting it going later.
> It doesn't look like the includes & libs are the same as you have specified.
Ok, that may well be the case. In fact, I have never used MikTeX... On
the other hand, the fallback solution via kpsewhich should be fine -
only a little slower but otherwise fully functional.
> Getting better, but still no luck. sorry, I just don't know the font stuff
> in latex well enough to guess what is going on.
>
> X:\pyx\examples>cat hello.py
> from pyx import *
> text.set(mode="latex")
> text.preamble(r"\usepackage{times}")
> c = canvas.canvas()
> c.text(0, 0, "Hello, world!")
> c.stroke(path.line(0, 0, 2, 0))
> c.writetofile("hello")
>
> X:\pyx\examples>python hello.py
> Traceback (most recent call last):
> File "hello.py", line 7, in ?
> c.writetofile("hello")
> File "c:\python23\Lib\site-packages\pyx\canvas.py", line 936, in
> writetofile
> for pritem in self.prolog():
> File "c:\python23\Lib\site-packages\pyx\canvas.py", line 661, in prolog
> result.extend(cmd.prolog())
> File "c:\python23\lib\site-packages\pyx\text.py", line 1784, in prolog
> return result + self.texrunner.prolog(self.dvinumber, self.page)
> File "c:\python23\lib\site-packages\pyx\text.py", line 2090, in prolog
> self.getdvi()
> File "c:\python23\lib\site-packages\pyx\text.py", line 2084, in getdvi
> self.dvifiles.append(DVIFile(dvifilename, debug=self.dvidebug))
> File "c:\python23\lib\site-packages\pyx\text.py", line 689, in __init__
> self.readfile()
> File "c:\python23\lib\site-packages\pyx\text.py", line 1091, in readfile
> state = self._read_page()
> File "c:\python23\lib\site-packages\pyx\text.py", line 1049, in _read_page
> file.read(file.readuchar()+file.readuchar()))
> File "c:\python23\lib\site-packages\pyx\text.py", line 777, in definefont
> self.fonts[num] = Font(fontname, c, q, d, self.tfmconv, self.debug > 1)
> File "c:\python23\lib\site-packages\pyx\text.py", line 520, in __init__
> raise RuntimeError("no information for font '%s' found in font mapping
> file,
> aborting" % name)
> RuntimeError: no information for font 'ptmr7t' found in font mapping file,
> aborting
Ah, you need to enable virtual font support via dvicopy. Please try
text.set(mode="latex", dvicopy=1)
Hopefully that works with MikTeX!
Jörg
--
JOERG LEHMANN | PyX - High quality PostScript figures with Python & TeX
jo...@lu... | Visit http://pyx.sourceforge.net/
|
|
From: Brett C. <br...@co...> - 2003-09-20 01:09:53
|
>
> Ah, you need to enable virtual font support via dvicopy. Please try
>
> text.set(mode="latex", dvicopy=1)
>
> Hopefully that works with MikTeX!
>
It works with hello.py. 2 things:
- I get a warning from gsview: The number of begin and end comments do not
match.
- I get files left around like xxxxxxxx.dvicopy.
However, it doesn't work with integral.py
Traceback (most recent call last):
File "integral.py", line 30, in ?
g.writetofile("integral")
File "c:\python23\Lib\site-packages\pyx\canvas.py", line 943, in
writetofile
pritem.write(file)
File "c:\python23\Lib\site-packages\pyx\prolog.py", line 123, in write
raise RuntimeError("cannot find type 1 font %s" % self.filename)
RuntimeError: cannot find type 1 font cmex10.pfb
X:\pyx\examples\graphs>find c:\miktex -name cmex10.pfb
c:\miktex\texmf\fonts\type1\bluesky\cm\cmex10.pfb
X:\pyx\examples\graphs>kpsewhich cmex10.pfb
X:\pyx\examples\graphs>
kspewhich doesn't report anything for that file -- I guess it should.
Lastly, dvicopy prints a fair bit to stdout about what it is doing that
users probably don't want to see.
Cheers,
Brett
ps. When this is ironed out, do you want some diffs to the code so that it
detects Miktex and does the right thing?
|
|
From: Joerg L. <jo...@us...> - 2003-09-21 12:56:54
|
On 20.09.03, Brett Calcott wrote:
> - I get a warning from gsview: The number of begin and end comments do not
> match.
Funny... In fact, they do not match (because there is no BeginComments)
but IMHO this is according to the DSC specs...
> - I get files left around like xxxxxxxx.dvicopy.
That should not be the case. Maybe André wants to look into this.
> However, it doesn't work with integral.py
>
> Traceback (most recent call last):
> File "integral.py", line 30, in ?
> g.writetofile("integral")
> File "c:\python23\Lib\site-packages\pyx\canvas.py", line 943, in
> writetofile
> pritem.write(file)
> File "c:\python23\Lib\site-packages\pyx\prolog.py", line 123, in write
> raise RuntimeError("cannot find type 1 font %s" % self.filename)
> RuntimeError: cannot find type 1 font cmex10.pfb
>
> X:\pyx\examples\graphs>find c:\miktex -name cmex10.pfb
> c:\miktex\texmf\fonts\type1\bluesky\cm\cmex10.pfb
>
> X:\pyx\examples\graphs>kpsewhich cmex10.pfb
>
> kspewhich doesn't report anything for that file -- I guess it should.
Yes, it should. Maybe you have to rebuild your ls-R database?
> Lastly, dvicopy prints a fair bit to stdout about what it is doing that
> users probably don't want to see.
That's already on the TODO list.
> ps. When this is ironed out, do you want some diffs to the code so that it
> detects Miktex and does the right thing?
Yes, of course, please send us the diffs.
Jörg
|