On Thursday 14 October 2004 6:18 pm, foofoofoo barbarbar wrote:

You're using a graphics inset but can't use the pdflatex compiler. You 
need to define a XFig -> PDF converter. See the Edit->Preferences 
dialog.

> Yes, unlike the external_templates files I've seen on
> the Net, the one that comes with this version does not
> mention any conversions to PDF.  Can I just use an
> external_templates file from the Net, or are these
> most likely for some devel version of LyX, and
> unlikely to work in my case?  Would this one work with
> my version?
>
> http://wiki.lyx.org/pmwiki.php/DevelExternalTemplates/Template

No, this won't work. This is from the external_templates file that 
will ship with LyX 1.4.x. I don't know who shoved it up on the wiki. 
Anyway, it won't work for several reasons:

* the transformation command is hard-coded into the external_templates 
file in LyX 1.3.x. In LyX 1.4.x, the external inset uses the same 
'converter' mechanism as is used by the graphics inset that you've 
been using. This gives you more flexibility.

* the transformation of an 'external' file in LyX 1.3.x, defined in 
the external_templates file, knows nothing about the different LaTeX 
flavours. Thus, XFig is converted to EPS or to the PSTEX mix of EPS 
file and LaTeX file containing the text. That's fine if you use the 
latex compiler. However, the pdflatex compiler is unable to handle 
EPS figures.

You could write your own PDFXFig template and place it in an 
external_templates file in your $HOME/.lyx directory. It would be 
identical to the XFig template that ships with LyX 1.3.x, but the 
LaTeX target would change to (something like)

Format LaTeX
    Product "\\begin{picture}(0,0)\\includegraphics{$$Basename.pdf}\
        \end{picture}\\input{$$Basename.pdftex_t}"
    UpdateCommand "python $$Sysdir/scripts/fig2pdftex.py \
        $$FName $$Parameters"
    UpdateResult "$$Basename.pdf"
    Requirement "graphicx"
FormatEnd

You'd have to write fig2pdftex.py, analogous to fig2pstex.py, to 
handle the conversion.

The important point is, however, that whilst this would work, it would 
have the same limitation as the existing XFig template. You could use 
it with the pdflatex compiler but not with the latex compiler.

It would produce much nicer results than your existing solution of 
converting XFig -> EPS (from the graphics inset) if your figures 
contain text which you've marked with the 'special' attribute.

* Final difference between external insets in LyX 1.3.x and 1.4.x. All 
those :

TransformCommand Rotate RotationLatexCommand
TransformCommand Resize ResizeLatexCommand
Product 
"$$RotateFront$$ResizeFront\\input{$$Basename.pstex_t}$$ResizeBack$$RotateBack"

The external inset in 1.4.x handles rotation, clipping and resizing of 
the image just like the graphics inset does. In fact, the only thing 
that it can't do that the graphics inset can handle is proper 
handling of compressed postscript images. Herbert will remember the 
pain that this caused us in coding up the graphics inset ;-)

Hope that some of this is illuminating.
Angus



Reply via email to