PhilipPirrip wrote:

>>>>> Why does \input@path end with two slashes, as in
>>>>> /home/user/directory//
>>>> IIRC this means that also sub directories are searched, but this should
>>>> be documented in some TeX or LaTeX docs.
> 
> Not sure how it all works for (La)TeX, I'm assuming this is all handled
> by the OS. Unixoids (OSX, Linux) don't care about any extra slashes,
> might be the same for Windows:
> http://unix.stackexchange.com/questions/1910/how-does-linux-handle-multiple-consecutive-path-separators-home-username
> 
> 
> 
>> I did some reserach, and could not find any LaTeX docs about double
>> slashes. What I know is that one slash is definitely needed, and that
>> these double slashes at the end do exist at least since LyX 1.2.
> 
> I'm 96% sure this is wrong, and it's especially wrong in this case

What do others think? Should we remove the second slash? I tend to say yes, 
since I could not find any documentation about it.

>>>>> and why is its output
>>>>> "/home/user/dir ectory/"/
>>>>> when the folder name contains spaces?
> 
> since the WHOLE path should be enclosed in quotation marks - as far as
> the OS is concerned, but TeX might behave differently and even not
> recognize the quotes as grouping characters.
> 
> 
> 
>>>>
>>>> Wiothout quotes only the part before the space would be used.
> 
> In an OS, yes. But wouldn't be so sure about TeX.

I am sure about that.

>>>> I believe
>>>> that the second slash is not included in the quotes since it is only a
>>>> special marker (see above).
> 
> I bet it's just a bug. And it's amazing how the quotes disappear from
> the os<< stream when there are no spaces in the path name.

Well, the code is programmed like that on purpose to be on the safe side.

>>> But one can always add the quotes, I assume, before using the command.
>> Of course you can do that. However, if you look how \input@path is used
>> by LaTeX packages
> 
> Hm... I thought \input@path was just a command being added by LyX at the
> compilation time for its own purposes. Isn't it? What LaTeX packages use
> \input@path?

No, LyX did not invent \input@path. In my texlive installation, it occurs 87 
times:

grep -r '\\input@path' /usr/local/texlive/current/texmf-dist/tex/latex/ | wc 
-l

LyX may not invent own rules for \input@path, it has to comply with the 
rules set up by LaTeX.

>>> You'll almost certainly have to add a file name at the end of the path,
>>> and then you're in trouble.
>>
>> Can you give an example?
> 
> My only experience with \input@path is from here
> http://wiki.lyx.org/BibTeX/Biblatex. I needed to \addbibresource{file
> name.bib} so that it's found at the compilation time. That meant that
> \addbibresource{} had to include the absolute path of the base document
> directory, and the only way of knowing it was by adding the \input@path
> to it: \addbibresource{\input@path/file name.bib}
> Now, the problem was that \input@path contains, quite unnecessary, curly
> braces in it (why, if the file path is only being forwarded to the OS,
> unless the path is being written to an aux file),

The curly braces are not unnecessary. They are required by LaTeX (see the 
explanation in $TEXMFDIST/tex/latex/base/texsys.cfg)

> quotation marks
> encoded as \string ", and even worse, placed even before the path ended.
> So one gets
> \addbibresource{{\string "/home/user/di rectory/\string "/file name.bib}}
> instead of, ideally (a slash or two more or less)
> \addbibresource{/home/user/di rectory/file name.bib}
> or
> \addbibresource{"/home/user/di rectory/file name.bib"}

This is not how \input@path is supposed to be used. I suggest to try this 
instead:

\filename@parse{file name.bib}
\addbibresource{\filename@area\filename@base\filename@ext}

\filename@parse searches the file, trying all directories in \input@path, 
and then defines the three variables \filename@area (contains the 
directory), \filename@base (contains the base name), \filename@ext (contains 
the extension).

> I made some tests. I created a directory named "dir
>> with space", then put all three attached files in there, and then tried
>> to view different formats. Result:
> 
> I unfortunately do not know how LyX handles all this internally and
> where \input@path is used in your example. But from the error code you
> can see what your path looks like:
> "...with space/"/./escher-lsd.eps
> Quite a mess, huh?

http://wiki.lyx.org/LaTeX/FilesWithSpecialChars explains why this is the 
only way that woprks, and how this mess is cleaned by a postprocessing 
script (which is for reasons I do not know only used on windows).

> That's why, I think, \input@path should contain no quotes, and whoever
> uses it should be aware that the qoutes are (or might be) missing. Of
> course, we should all check if quotes in the file name mean anything to
> LaTeX, i.e. is the string within the quotes treated as an entity.

These checks have been done already (although one could retest whether the 
results are still valid after 10 years), see the wiki page.

>>> At least for biblatex (and biber), the path doesn't have to include any
>>> quotes.
>> Please give an example how to use biblatex and biber with paths including
>> spaces and \input@path.
> 
> There's an old example for Windows here
> http://wiki.lyx.org/BibTeX/Biblatex (I haven't touched that when I
> rewrote the page)
> And there's also this
> http://tex.stackexchange.com/questions/102258/referencing-bib-files-with-spaces-in-the-filename
> 
> 
> 
>> Correction: TEXINPUTS is still used, but \input@path is used in addition,
>> since relative paths starting with ./ or ../ do not work with TEXINPUTS.
> 
> But why is then TEXINPUTS prefix in LyX>Tools>Preferences exactly ./

This is a misunderstanding: TEXINPUTS does not work if the referenced file 
name starts with ./ or ../. TEXINPUTS itself may contain such paths. 
Example:

\includegraphics{./example.eps}

This file is not found in directories in TEXINPUTS, but it is found in 
directories in \input@path.

>>> There are BIBINPUTS in that case,
>>> http://tex.stackexchange.com/questions/67205/use-bibinputs-to-specify-other-location-for-bib-file
>>> so I still have to report to the LyX people (who did a great job
>>> otherwise)
>>
>> BIBINPUTS is indeed not set by LyX. Searching the bugtracker shows that
>> there is already a quite old enhancement request about that (which I
>> completely forgot): http://www.lyx.org/trac/ticket/2645
>>
>> I think it would be good to add a biblatex/biber test case there, so that
>> this can be considered when a fix is implemented.
> 
> 
> 
> But will that work with ./ ?    ./ can be anything, even the temporary
> folder where the compilation is taking place, and we want it to be the
> document folder.

I don't know. Please try it out and add the result to the ticket if you want 
progress there.

> If you're afraid of touching \input@path, would it be possible just to
> add another command that would contain the bare path, no braces, no
> quotation marks? Call it \LyX@basepath

I would first add support for BIBINPUTS (since that is needed anyway), and 
then see what does not work.


Georg


Reply via email to