Jean-Marc Lasgouttes wrote:

> Helge> And how about files referenced from commands in ERT insets
> Helge> and/or preamble commands?
> 
> AFAIK, preambles of child documents are not output, so this should not
> be a concern.

Of course.  I was thinking of a macro with relative-file operation
defined
in the main document preamble, and _used_ in some document included
from a subdirectory. such as the "list a source file my way" macro.
 
[...]
> Well, if you do this kind of complicated things, you can probably also
> use ERT to get \subimport* ;)

If all I wanted to was to include latex - yes!  Unfortunately, subimport
in ERT can't include a lyx file - I need lyx to convert the included
lyx to tex _when necessary_. I.e. when the .lyx is newer than the
existing .tex
I don't want to export all of them manually. :-(

> Seriously, I agree that this will not be supported. However, when you
> do heavy ERT, you are basically on your own. We try to have a policy
> of avoiding to add code just for the sake of making ERT work.
> 
I was only hoping that the ERT that works with everything in the same
directory also could work when importing from a subdirectory.

Hmm.  You claim you'll make external insets work from
subdirectories - perhaps I should try creating an external inset 
for lyx documents instead?

> Helge> This is my reason for using import.sty, because it supports
> Helge> this transparently. And I guess lots of other people do
> Helge> similiar things, i.e. reference various files from ERT. And
> Helge> hope to include that lyx-file from another in another
> Helge> directory.
> 
> I took a look at your patch and at import.sty, and here is my current
> thinking on it
> 
> The pros:
> 
> - it is a clean patch and I have no stylistic issue with it
> 
> - import.sty is not too new (meaning it will be generally available)
>   and is written by Donald Arseneau (this last point is important
>   because it means we can rely on its quality)
> 
> - it works with ERT and external insets
> 
> The cons:
> 
> - what your patch does not do is to make sure that, when using a temp
>   dir, all files end up in the master document's
> 
I know it currently only works without temp dirs - littering my
directories with all the in-between stuff latex produce.
I'm willing to fix that (and other shortcomings, if any) if that
is the key to get it into lyx.  It is something I won't
bother with if I know I'll be the only user ever though.

Also note that the current patch is qt only.  I have an xforms
patch for 1.2.3 that I can port easily _if_ necessary.

> - it depends on an extra package, whereas we have all the information
>   to do it ourselves

Except for stuff included in ERT. :-)
 
> - not all packages honor \input@path (the macro that makes all that
>   possible). For example skak.sty (used for the chess external
>   template) does not.
> 
Now that is a bad one, seems another approach might be necessary
after all.  How about the following:

1. Use your way of supporting subdirectory includes, with one addition:
2. Lyx outputs a \lyxpath in the exported .tex, telling what
subdirectory
   we're in.  (i.e. file included from the same directory 
   => \renewcommand{\lyxpath}{./}  (or an empty string perhaps)
   File included from subdir/ (relative to the master document)
   => \renewcommand{\lyxpath}{subdir/}
   and so on.  

   Now anything within lyx is supported with no extra GUI
   or packages, and us poor ERT-users have the hook
   we need to support our own macros
   properly.  I could simply add \lyxpath to the filespec in my
   file inclusion macros.


> - I do not think either that it will work for \bibliography{} when the
>   bib file is in a subdirectory. This case can work easily (meaning I
>   have to write it) with my approach
> 
> - this adds yet another way of including files in the dialog. I
>   suspect that this will rapidly become very confusing for users who
>   do not need all these bells and whistles. I tried to find a solution
>   that ``just works''.

Well, if you go fo the \lyxpath thing I have everything I need too. :-)
\lyxpath will probably not clash with other packages either.

Helge Hafting

Reply via email to