Hi all. The current version of the external inset code is not very friendly 
if the external file does not exist.

> If the xfig file does not exist (cannot be found), then the 
> generation of the dvi/pdf file fails. Would be nice to do 
> as the graphics inset does (a box containing "<file name> not found"
> in the resulting dvi/pdf file).
> Also, each time we fail to find the xfig file we get a little 
> error box popping up to tell us. Should have a max of one error box.
> Maybe none.

I show the relevant part of the xfig template below:

Template XFig
        Format LaTeX
                Product "\\input{$$Basename.pstex_t}"
                UpdateFormat pstex
                UpdateResult "$$Basename.pstex_t"
                Requirement "graphicx"
        FormatEnd
TemplateEnd

This tells LyX to output the LaTeX defined as 'Product'. Rather than test 
ourselves whether 'UpdateResult' was successful, I thought it would be nice 
if we could get latex to do the work for us. I'm imagining something like 
the following psuedo code:

        if (exists($$Basename.pstex_t))
                \input{$$Basename.pstex_t}
        else
                \fbox{$$Basename.pstex_t not found}

Unfortunately, my latex isn't up to the task. Can you help me out?
        \ifthenelse{???}
                {\input{$$Basename.pstex_t}}
                {\fbox{$$Basename.pstex_t not found}

The alternative to this strategy is to take the responsibility to decide 
what latex to output upon ourselves. Extending the External Template syntax 
to something like this would do the trick:
Template XFig
        Format LaTeX
                Product "\\input{$$Basename.pstex_t}"
                FailedProduct "\\fbox{$$Basename.pstex_t not found}"
                UpdateFormat pstex
                UpdateResult "$$Basename.pstex_t"
                Requirement "graphicx"
        FormatEnd
TemplateEnd

Clearly, this isn't hard to do, but it's more work than the first 
suggestion. Are there any disadvantages to using the ithen package?

Regards,
Angus

Reply via email to