On Wed, 5 Feb 2003, Angus Leeming wrote:

> Christian Ridderström wrote:
>
> I'm not happy. You've showed me an elegant and foolproof way of doing this, 
> so why not use it:
> 
> \\converter tgif eps 'tgif -stdout -print -color -eps $$i > $$o' ""
> \\converter tgif png 'tgif -stdout -print -color -png $$i > $$o' ""

duh... well, I tried the "foolproof" way and there's a snag (I've 
probably tried it before but forgot about it). Here's the -dbg output:

tgif -print -png -stdout ${infile} > ${outfile} ||
[snip]
xpmtoppm: test2.xpm - No such file or directory
pnmtopng: Error reading magic number from PBM file.  Most often, this  means your 
input file is empty.
Image conversion succeeded.
Unable to find converted file!

There are two weird things here... one is that it actually works even 
though these errors are reported, and the other is that an empty .png-file 
is created in the current working directory. I guess this must be a 
problem with how tgif uses xpmtoppm and pnmtopng.

It's really the empty file that's annoying since it clutters your 
directory.

I did some checking and the last error message:
        Unable to find converted file!
comes after the conversion is done, but it's weird since lyx shows the 
image anyway.

This eps converter works without producing clutter though:
\converter tgif eps 'tgif -print -stdout -color -eps $$i > $$o' ""

(note the changed order of arguments, -print must be first)


Another strange thing is that 
        \converter tgif eps "tgif -print -color -eps $$i" ""
works when viewing postscript. So I did some more checking 
and it turns out that tgif writes the output file in the same directory as 
the input file for at least these formats:
        ps, pdf

whereas for these formats:
        gif, xpm, xbm and jpeg

it gets printed to the current directory. Also, when viewing 
postscript the name of the output-file should be the same as for the 
input file but with another extension, and this is what you get from tgif 
per default. Whereas for showing images in lyx, the output name is 
different and then you run into problems. 

I seem to remember that you can specify how tgif does pnm-conversion, so 
I'll look into that.


> >> New? tokens in the converter string
> >> -----------------------------------
> > Where can I find the complete list of these "tokens", look in the source?
> > (where?)
> 
> $ grep "\$\$[a-zA-z]" src/*.C src/graphics/*.C

Ok... I checked the source and it seems that there only are $$i, $$o and 
$$b, so I'll file a feature request for this. It's hardly high priority, 
but now that I know where it is I could even fix it myself :-)  (guess I 
should finish the thesis first though :-(

/C

-- 
Christian Ridderström, +46-8-790 91 37           http://www.md.kth.se/~chr
Mechatronics lab, Dept. of Machine Design        http://www.md.kth.se


Reply via email to