Re: \input@path - two slashes, quotation marks
PhilipPirrip wrote: > I suspect the other slash was added as a bug fix for those OS's that do > not have it at the end of the path, can't see any other reason. > So I suppose this should be tested on OSX and Windows as well. It is not an OS issue. LyX has an OS abstraction layer for this kind of stuff, and therefore the code that determines the path returns a slash at the end for all OSes. I'll remove the second slash (not in the stable 2.1 branch of course), and we'll see if anybody screams (but I doubt that). > I wish this was true, but no... \filename@parse only *parses* (no search > involved) its argument for the three parts, and it does it in a very > primitive way. > > > \documentclass{article} > \begin{document} > \makeatletter > \filename@parse{/home/user/doesn.t exist/test v2.1 new.bib} > \texttt{\meaning\filename@area} > > \texttt{\meaning\filename@base} > > \texttt{\meaning\filename@ext} > > \texttt{\meaning\input@path} > \makeatother > \end{document} > > > check: > http://tex.stackexchange.com/questions/39634/how-to-trim-tex-for-each-filename-read-from-an-external-file OK, then I misunderstood the TeX code (I used to be better at that). > Since the way \input@path is being used in the biblatex hack from > http://wiki.lyx.org/BibTeX/Biblatex is barely legal, maybe LyX should > define its own command, say \LyX@basepath that'd contain the absolute > path to the master .lyx document (no qoutes, no curly braces - only for > the brave). > Would you be willing to do that? (being that biblatex support is nowhere > on the horizon yet) After all these discussions it is clear that something like this is needed. However, I do not want to clutter all documents with that (since 95% of the users don't need it). I would prefer a solution where we extend the layout definition language so that you could use a placeholder that will be replaced by LyX with the master document path. Then everybody who needs this path could write a module that pulls in the path into a LaTeX macro in the most simple case, or in more advanced cases it could directly be used in the preamble code that needs it. Georg
Re: \input@path - two slashes, quotation marks
Thanks Georg, I hope we'll eventually get somewhere. On 08/26/2015 04:42 PM, Georg Baum wrote: What do others think? Should we remove the second slash? I tend to say yes, since I could not find any documentation about it. I suspect the other slash was added as a bug fix for those OS's that do not have it at the end of the path, can't see any other reason. So I suppose this should be tested on OSX and Windows as well. Well, the code is programmed like that on purpose to be on the safe side. I understand the intention, but I don't think that's the right solution for this case. It's just that you can't feed this {\string /home/user/di rectory/\string /file name.bib} to any, let's call it, file= option without fully expanding first, and then you're back to what you tried to avoid. In addition, biblatex doesn't seem to recognize quoted paths and the quotes have to be stripped off. P.S. From what you said below, I now see that \input@path list was not meant to be used in this way, however it's still the only method of obtaining the absolute paths we have. 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 Hm, yeah. I can see that. I don't know exactly when and what it's used for, though. LaTeX alone does not set it to any particular path. This, for example, \documentclass{article} \begin{document} \makeatletter \texttt{\meaning\input@path} \makeatother \end{document} doesn't seem to have it defined, \input@path is only there when you compile it from LyX. A few random pages from the web made me think one has to define \input@path oneself, and this will be the last resort for LaTeX, but no other supporting processors, to look for the files. The curly braces are not unnecessary. They are required by LaTeX (see the explanation in $TEXMFDIST/tex/latex/base/texsys.cfg) OK, I see... \input@path is a LIST of directories. But then, what additional protection the quotes (are supposed to) give if the whole thing within {} will be parsed as an entity anyway? There's unfortunately no mention of the quotes or paths with spaces in texsys.cfg. 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} I wish this was true, but no... \filename@parse only *parses* (no search involved) its argument for the three parts, and it does it in a very primitive way. \documentclass{article} \begin{document} \makeatletter \filename@parse{/home/user/doesn.t exist/test v2.1 new.bib} \texttt{\meaning\filename@area} \texttt{\meaning\filename@base} \texttt{\meaning\filename@ext} \texttt{\meaning\input@path} \makeatother \end{document} check: http://tex.stackexchange.com/questions/39634/how-to-trim-tex-for-each-filename-read-from-an-external-file Since the way \input@path is being used in the biblatex hack from http://wiki.lyx.org/BibTeX/Biblatex is barely legal, maybe LyX should define its own command, say \LyX@basepath that'd contain the absolute path to the master .lyx document (no qoutes, no curly braces - only for the brave). Would you be willing to do that? (being that biblatex support is nowhere on the horizon yet) (when the documents are exported to LaTeX \LyX@basepath should still be defined, but can be simply ./) \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). 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. My tests show, let's note it, that quotes don't work with biblatex and the quoted path is never found.
Re: \input@path - two slashes, quotation marks
Thanks Georg, I hope we'll eventually get somewhere. On 08/26/2015 04:42 PM, Georg Baum wrote: What do others think? Should we remove the second slash? I tend to say yes, since I could not find any documentation about it. I suspect the other slash was added as a bug fix for those OS's that do not have it at the end of the path, can't see any other reason. So I suppose this should be tested on OSX and Windows as well. Well, the code is programmed like that on purpose to be on the safe side. I understand the intention, but I don't think that's the right solution for this case. It's just that you can't feed this {\string "/home/user/di rectory/\string "/file name.bib} to any, let's call it, "file=" option without fully expanding first, and then you're back to what you tried to avoid. In addition, biblatex doesn't seem to recognize quoted paths and the quotes have to be stripped off. P.S. From what you said below, I now see that \input@path list was not meant to be used in this way, however it's still the only method of obtaining the absolute paths we have. 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 Hm, yeah. I can see that. I don't know exactly when and what it's used for, though. LaTeX alone does not set it to any particular path. This, for example, \documentclass{article} \begin{document} \makeatletter \texttt{\meaning\input@path} \makeatother \end{document} doesn't seem to have it defined, \input@path is only there when you compile it from LyX. A few random pages from the web made me think one has to define \input@path oneself, and this will be the last resort for LaTeX, but no other supporting processors, to look for the files. The curly braces are not unnecessary. They are required by LaTeX (see the explanation in $TEXMFDIST/tex/latex/base/texsys.cfg) OK, I see... \input@path is a LIST of directories. But then, what additional protection the quotes (are supposed to) give if the whole thing within {} will be parsed as an entity anyway? There's unfortunately no mention of the quotes or paths with spaces in texsys.cfg. 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} I wish this was true, but no... \filename@parse only *parses* (no search involved) its argument for the three parts, and it does it in a very primitive way. \documentclass{article} \begin{document} \makeatletter \filename@parse{/home/user/doesn.t exist/test v2.1 new.bib} \texttt{\meaning\filename@area} \texttt{\meaning\filename@base} \texttt{\meaning\filename@ext} \texttt{\meaning\input@path} \makeatother \end{document} check: http://tex.stackexchange.com/questions/39634/how-to-trim-tex-for-each-filename-read-from-an-external-file Since the way \input@path is being used in the biblatex hack from http://wiki.lyx.org/BibTeX/Biblatex is barely legal, maybe LyX should define its own command, say \LyX@basepath that'd contain the absolute path to the master .lyx document (no qoutes, no curly braces - only for the brave). Would you be willing to do that? (being that biblatex support is nowhere on the horizon yet) (when the documents are exported to LaTeX \LyX@basepath should still be defined, but can be simply ./) \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). 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. My tests show, let's note it, that quotes don't work with biblatex and the quoted path is never found.
Re: \input@path - two slashes, quotation marks
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
Re: \input@path - two slashes, quotation marks
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
Re: \input@path - two slashes, quotation marks
PhilipPirrip wrote: On 08/19/2015 04:44 PM, Georg Baum wrote: 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. 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 don't have older sources on my disk, and unfortunately I am too stupid to use git blame on older revisions, so I don't know when this was introduced. Maybe it was by accident? and why is its output /home/user/dir ectory// (note quotation marks, and two separate ending slashes) when the folder name contains spaces? Wiothout quotes only the part before the space would be used. I believe that the second slash is not included in the quotes since it is only a special marker (see above). 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, then you see that this is not done: If they are well written then they use \filename@parse from $TEXMDIST/tex/latex/base/latex.ltx to expand file names, and I could not see any quotes adding there. 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? 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: PDF (pdflatex): works fine Postscript: Does not work: dvips: Unknown keyword (with) in \special will be ignored dvips: Unknown keyword (space//./escher-lsd.eps) in \special will be ignored dvips: Could not find figure file /home/xxx/dir; continuing. These results did not change if I removed the second slash after the double quote. However, the double quotes are needed: After removing them, neither pdflatex not dvips find the graphics file. Look at the answers here for removing the quotes: http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string IMHO removing the quotes is a workaround if you don't want to (or can't) change LyX. I am more interested in how LyX should behave ideally. 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. As you already found out \input@path does not work in several cases, therefore LyX changed to use TEXINPUTS. If biber does not work with either mechanism then please report this to the biber people. Correction: TEXINPUTS is still used, but \input@path is used in addition, since relative paths starting with ./ or ../ do not work with TEXINPUTS. 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. Georg inputpath.lyx Description: application/lyx escher-lsd.pdf Description: Adobe PDF document
Re: \input@path - two slashes, quotation marks
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 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 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. 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? 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), 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 possible with biber, but not with bibtex as a processor - the latter does not allow spaces in the file name - possibly even when the path is quoted: http://tex.stackexchange.com/questions/102258/referencing-bib-files-with-spaces-in-the-filename) 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? 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. There was a mention that tricks with \input@path haven't always worked, I'm beginning to think it was exactly for these reasons - the command can produce amazingly messy paths! Look at the answers here for removing the quotes: http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string IMHO removing the quotes is a workaround if you don't want to (or can't) change LyX. I am more interested in how LyX should behave ideally. I cannot think of any case that uses only the directory path, i.e. that's not appengind a file name to it. Then {/home/user/dir ectory//}./file name.something can't be the proper way of qouting the path in this universe. 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.
Re: \input@path - two slashes, quotation marks
PhilipPirrip wrote: > On 08/19/2015 04:44 PM, Georg Baum wrote: >> 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. 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 don't have older sources on my disk, and unfortunately I am too stupid to use git blame on older revisions, so I don't know when this was introduced. Maybe it was by accident? >>> and why is its output >>> "/home/user/dir ectory/"/ >>> (note quotation marks, and two separate ending slashes) when the folder >>> name contains spaces? >> >> Wiothout quotes only the part before the space would be used. I believe >> that the second slash is not included in the quotes since it is only a >> special marker (see above). > > 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, then you see that this is not done: If they are well written then they use \filename@parse from $TEXMDIST/tex/latex/base/latex.ltx to expand file names, and I could not see any quotes adding there. > 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? 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: PDF (pdflatex): works fine Postscript: Does not work: dvips: Unknown keyword (with) in \special will be ignored dvips: Unknown keyword (space/"/./escher-lsd.eps") in \special will be ignored dvips: Could not find figure file /home/xxx/dir; continuing. These results did not change if I removed the second slash after the double quote. However, the double quotes are needed: After removing them, neither pdflatex not dvips find the graphics file. > Look at the answers here for removing the quotes: > http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string IMHO removing the quotes is a workaround if you don't want to (or can't) change LyX. I am more interested in how LyX should behave ideally. > 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. >> As you already found out \input@path does not work in several cases, >> therefore LyX changed to use TEXINPUTS. If biber does not work with >> either mechanism then please report this to the biber people. Correction: TEXINPUTS is still used, but \input@path is used in addition, since relative paths starting with ./ or ../ do not work with TEXINPUTS. > 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. Georg inputpath.lyx Description: application/lyx escher-lsd.pdf Description: Adobe PDF document
Re: \input@path - two slashes, quotation marks
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 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 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. 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? 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), 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 possible with biber, but not with bibtex as a processor - the latter does not allow spaces in the file name - possibly even when the path is quoted: http://tex.stackexchange.com/questions/102258/referencing-bib-files-with-spaces-in-the-filename) 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? 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. There was a mention that tricks with \input@path haven't always worked, I'm beginning to think it was exactly for these reasons - the command can produce amazingly messy paths! Look at the answers here for removing the quotes: http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string IMHO removing the quotes is a workaround if you don't want to (or can't) change LyX. I am more interested in how LyX should behave ideally. I cannot think of any case that uses only the directory path, i.e. that's not appengind a file name to it. Then {"/home/user/dir ectory/"/}./file name.something can't be the proper way of qouting the path in this universe. 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
Re: \input@path - two slashes, quotation marks
On 08/19/2015 04:44 PM, Georg Baum wrote: 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. and why is its output /home/user/dir ectory// (note quotation marks, and two separate ending slashes) when the folder name contains spaces? Wiothout quotes only the part before the space would be used. I believe that the second slash is not included in the quotes since it is only a special marker (see above). But one can always add the quotes, I assume, before using the command. You'll almost certainly have to add a file name at the end of the path, and then you're in trouble. Look at the answers here for removing the quotes: http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string At least for biblatex (and biber), the path doesn't have to include any quotes. As you already found out \input@path does not work in several cases, therefore LyX changed to use TEXINPUTS. If biber does not work with either mechanism then please report this to the biber people. 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)
Re: \input@path - two slashes, quotation marks
On 08/19/2015 04:44 PM, Georg Baum wrote: 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. and why is its output "/home/user/dir ectory/"/ (note quotation marks, and two separate ending slashes) when the folder name contains spaces? Wiothout quotes only the part before the space would be used. I believe that the second slash is not included in the quotes since it is only a special marker (see above). But one can always add the quotes, I assume, before using the command. You'll almost certainly have to add a file name at the end of the path, and then you're in trouble. Look at the answers here for removing the quotes: http://tex.stackexchange.com/questions/259015/one-liner-for-removing-characters-from-a-string At least for biblatex (and biber), the path doesn't have to include any quotes. As you already found out \input@path does not work in several cases, therefore LyX changed to use TEXINPUTS. If biber does not work with either mechanism then please report this to the biber people. 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)
Re: \input@path - two slashes, quotation marks
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. and why is its output /home/user/dir ectory// (note quotation marks, and two separate ending slashes) when the folder name contains spaces? Wiothout quotes only the part before the space would be used. I believe that the second slash is not included in the quotes since it is only a special marker (see above). As you already found out \input@path does not work in several cases, therefore LyX changed to use TEXINPUTS. If biber does not work with either mechanism then please report this to the biber people. Georg
Re: \input@path - two slashes, quotation marks
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. > and why is its output > "/home/user/dir ectory/"/ > (note quotation marks, and two separate ending slashes) when the folder > name contains spaces? Wiothout quotes only the part before the space would be used. I believe that the second slash is not included in the quotes since it is only a special marker (see above). As you already found out \input@path does not work in several cases, therefore LyX changed to use TEXINPUTS. If biber does not work with either mechanism then please report this to the biber people. Georg
Re: \input@path - two slashes, quotation marks
Did a little research. \input@path is in src/Buffer.cpp, but since 2.0.1 another method has been introduced /see below/. It, however, doesn't seem to work for biber, no .bib files are found. So, any idea why \input@path exports, or should export {/home/user/dir ecto ry/} instead of simple /home/user/dir ecto ry/ src/Buffer.cpp: os \\makeatletter\n \\def\\input@path{{ docdir /}}\n \\makeatother\n; What's new in version 2.0.1? We would like to highlight the improved handling of external files referenced from ERT. This may cause issues for those who made use of the undocumented \input@path hack. See the ANNOUNCE file again for how to do things the new way. New methods for calling external scripts should also solve several issues on Windows. What's new in LyX 2.0.1 === The support for using external files in ERT has been improved by the introduction of a prefix for the TEXINPUTS environment variable. This prefix can be set in preferences and by default includes the document directory (represented by a single '.'). The prefix can be set to any list of paths separated by the default separator for a given platform (':' on unix like systems and ';' on windows). When a file should be included by LaTeX, the paths listed in TEXINPUTS will be searched in turn for finding it. Note that any non-absolute path listed in the TEXINPUTS prefix is considered to be relative to the document directory, i.e., the directory where the LyX file lives. Users are advised to always include '.' (the document dir) as one of the path components, otherwise compilation may fail for some documents. This is because the previous (undocumented) mechanism based on the use of the \input@path macro has been dropped. The old mechanism did not work in all cases and was kind of a hack. Old documents using that undocumented hack for obtaining the path of the LyX file will have to be revised. A clean way for obtaining the document path is using the info inset through the info-insert buffer path LyX function. On 08/04/2015 02:39 PM, PhilipPirrip wrote: Why does \input@path end with two slashes, as in /home/user/directory// and why is its output /home/user/dir ectory// (note quotation marks, and two separate ending slashes) when the folder name contains spaces?
Re: \input@path - two slashes, quotation marks
Did a little research. \input@path is in src/Buffer.cpp, but since 2.0.1 another method has been introduced /see below/. It, however, doesn't seem to work for biber, no .bib files are found. So, any idea why \input@path exports, or should export {"/home/user/dir ecto ry"/} instead of simple /home/user/dir ecto ry/ src/Buffer.cpp: os << "\\makeatletter\n" << "\\def\\input@path{{" << docdir << "/}}\n" << "\\makeatother\n"; What's new in version 2.0.1? We would like to highlight the improved handling of external files referenced from ERT. This may cause issues for those who made use of the undocumented \input@path hack. See the ANNOUNCE file again for how to do things the new way. New methods for calling external scripts should also solve several issues on Windows. What's new in LyX 2.0.1 === The support for using external files in ERT has been improved by the introduction of a prefix for the TEXINPUTS environment variable. This prefix can be set in preferences and by default includes the document directory (represented by a single '.'). The prefix can be set to any list of paths separated by the default separator for a given platform (':' on unix like systems and ';' on windows). When a file should be included by LaTeX, the paths listed in TEXINPUTS will be searched in turn for finding it. Note that any non-absolute path listed in the TEXINPUTS prefix is considered to be relative to the document directory, i.e., the directory where the LyX file lives. Users are advised to always include '.' (the document dir) as one of the path components, otherwise compilation may fail for some documents. This is because the previous (undocumented) mechanism based on the use of the \input@path macro has been dropped. The old mechanism did not work in all cases and was kind of a hack. Old documents using that undocumented hack for obtaining the path of the LyX file will have to be revised. A clean way for obtaining the document path is using the info inset through the "info-insert buffer path" LyX function. On 08/04/2015 02:39 PM, PhilipPirrip wrote: Why does \input@path end with two slashes, as in /home/user/directory// and why is its output "/home/user/dir ectory/"/ (note quotation marks, and two separate ending slashes) when the folder name contains spaces?
\input@path - two slashes, quotation marks
Why does \input@path end with two slashes, as in /home/user/directory// and why is its output /home/user/dir ectory// (note quotation marks, and two separate ending slashes) when the folder name contains spaces?
\input@path - two slashes, quotation marks
Why does \input@path end with two slashes, as in /home/user/directory// and why is its output "/home/user/dir ectory/"/ (note quotation marks, and two separate ending slashes) when the folder name contains spaces?