Georg Baum wrote:
> I think the problematic case was something like
> 
> file foo1.lyx inputs dir1/foo2.lyx
> file dir1/foo2.lyx inputs dir1/dir2/foo3.lyx
> file dir1/dir2/foo3.lyx uses graphics graph.eps (in dir1/dir2)
> 
> the \includegraphics for graph.eps should read
> \includegraphics{dir1/dir2/graph.eps}
> but it did not.

Ok. Thanks. A very clear explanation of what is needed.

So, can I summarise the requirement?

    // If this is a child document and the parent is
    // already loaded, then define 'base' as parent.base().
    // If the parent is also a child, then it would return
    // its own 'base'.
    string base;
    if (!bufferparams.parentname.empty() &&
        bufferlist.exists(bufferparams.parentname)) {
            Buffer const * parent =
                bufferlist.getBuffer(params().parentname);
            base = parent->base();
    }

Leading to the output of:
    os << "\\includegraphics{"
       << base
       << relative_file_name
       << '}';

Some thought would have to go into the definition of Buffer::base(), 
but wouldn't this (or something like it) work automagically for 
InsetExternal also?

-- 
Angus

Reply via email to