On Mon, May 09, 2011 at 10:39:18AM -0400, Richard Heck wrote:

> On 05/08/2011 02:45 PM, Enrico Forestieri wrote:
> > The \input@path mechanism (already used by LyX) is not always sufficient
> > and there are cases where a file can be found by LaTeX and also by other
> > ancillary programs (such as dvi previewers) only if the document dir is
> > placed in the TEXINPUTS environment variable.
> >
> > The attached patch adds the document dir and all of its subdirs to
> > TEXINPUTS, such that the attached example in the tar archive works in LyX.
> > I would like to start a discussion on this issue, more precisely on what
> > LyX should do. The options are:
> > 1) Add the document dir and all of its subdirs to TEXINPUTS (done by the 
> > patch)
> > 2) Add the document dir but not the subdirs to TEXINPUTS
> > 3) Make user configurable the path to add to TEXINPUTS (à la Path prefix)
> >
> > The disadvantage of option 1) is that a whole tree is then scanned by TeX.
> > If you load a document placed at the root of your home directory, then all
> > subdirectories are scanned.
> >
> > The disadvantage of option 2) is that it does not always work. For example,
> > it would not work with the attached example.
> >
> > Maybe option 3) is the most flexible and can avoid problems. For example,
> > I discovered that MiKTeX is really upset if one of the subdirectories has
> > asian characters in its name and stops compilation with a strange error,
> > even if nothing would be loaded from there (i.e., its mere presence in
> > TEXINPUTS causes problems).
> >
> I guess I would prefer (3) for this reason. I can imagine even worse
> problems, involving circular links, though I didn't look in detail at
> the code.

Note that that would be a bug in TeX, as it is responsible for the
recursion, but I agree that (3) is the most flexible and safe (because
it allows to switch off the feature) option and committed it at r38681.

One thing that I forgot to mention in the log is that this will not
allow to recognize latex classes placed at random, because TEXINPUTS
will only be set for converters/viewers and not, for example, when
configure.py is run. Of course, a latex class in the document directory
will be recognized and used at compile time, it simply will not show
as available in the "TeX Information" window. As a last thing, I set
the default value of the TEXINPUTS prefix to '.', i.e., the current
document directory, as I think this is what the casual user expects.

To conclude, note that even if the patch may seem large, it is really
simple and not invasive, such that it can be safely backported to branch.

-- 
Enrico

Reply via email to