Discussion:
Absolute Paths in LyX-LaTeX documents
dd3fmlli
2014-07-14 14:55:10 UTC
Permalink
Hi all,
I am a long-time LyX user and I can program in C++ and Python, so I would
like to to give a hand in the development of my favorite software.
Apart from this, I'm writing because I was wondering how to use only
relative paths in LyX documents, in particular in LaTeX preamble or TeX
inserts. As far as I know this is impossible at the moment (e.g. in the
biblatex guide http://wiki.lyx.org/BibTeX/Biblatex is reported that the
absolute path is needed).
A possible, very naive, work around of this issue would be to
automatically add in the latex temporary file (I guess its name is
"buffer", right?)

\def\relativePath{/from/relative/toAbs}


or even

\newcommand{\makeAbsPath}[1] {\relativePath/#1}
and when the document is exported in latex the definition can be replaced
by
\def\relativePath{./}
\batchmode
\makeatletter
\makeatother
but it doesn't work for bibtex and possible packages a user want to add.

Is in your opinion a possible enhancement or could it create problems? Did
you already considered this, or similar, options? I could not find
anything in the lists.
I know that in case of white spaces in the paths it could create problems,
but in many case it would solve this issue.

What do you think?

Best,
Dimitri
Georg Baum
2014-07-14 18:55:22 UTC
Permalink
Post by dd3fmlli
Hi all,
I am a long-time LyX user and I can program in C++ and Python, so I would
like to to give a hand in the development of my favorite software.
You are very welcome! We can always need helping hands.
Post by dd3fmlli
Apart from this, I'm writing because I was wondering how to use only
relative paths in LyX documents, in particular in LaTeX preamble or TeX
inserts. As far as I know this is impossible at the moment (e.g. in the
biblatex guide http://wiki.lyx.org/BibTeX/Biblatex is reported that the
absolute path is needed).
Absolute paths are only needed for unsupported features. All file related
insets allow relative paths, and preserve them even in the temp dir (either
by copying the files, or by adding some search paths to the LyX generated
preamble part, as you found out already, or by setting an environment
variable with search paths).
Post by dd3fmlli
A possible, very naive, work around of this issue would be to
automatically add in the latex temporary file (I guess its name is
"buffer", right?)
\def\relativePath{/from/relative/toAbs}
or even
\newcommand{\makeAbsPath}[1] {\relativePath/#1}
and when the document is exported in latex the definition can be
replaced by
\def\relativePath{./}
\batchmode
\makeatletter
\makeatother
but it doesn't work for bibtex and possible packages a user want to add.
Is in your opinion a possible enhancement or could it create problems?
I don't think that this would work in general. Like the current solution, it
would only work for specific packages.
Post by dd3fmlli
Did
you already considered this, or similar, options? I could not find
anything in the lists.
I know that in case of white spaces in the paths it could create problems,
but in many case it would solve this issue.
There have been discussions about relative and absolute paths, and also bug
entries, but I don't remember the details. The current solution has evolved
over the years. The general idea is: Be friendly to user code in the
preamble and in ERT, i.e. try to make it work in as many cases as possible,
but do never parse the preamble or ERT.

If you can find a solution along this line that improves the situation for
some packages, then we should discuss it. However, I believe it will be
quite difficult to do so, and I suggest a different approach: Why not
starting to implement native biblatex support? See
http://www.lyx.org/trac/ticket/4065 for details what has been thought
already. The implementation part should not be difficult (many
infrastructure parts are already there), what is currently missing is
somebody who understands the interface of biblatex well enough to propose
how to integrate it with LyX. If you are familiar with biblatex and want to
give it a try then I think that many people would appreciate it very much!



Georg
dd3fmlli
2014-07-15 19:40:03 UTC
Permalink
Thank you!
Post by Georg Baum
There have been discussions about relative and absolute paths, and also bug
entries, but I don't remember the details. The current solution has evolved
over the years. The general idea is: Be friendly to user code in the
preamble and in ERT, i.e. try to make it work in as many cases as possible,
but do never parse the preamble or ERT.
I see the point.
Post by Georg Baum
If you can find a solution along this line that improves the situation for
some packages, then we should discuss it. However, I believe it will be
quite difficult to do so, and I suggest a different approach: Why not
starting to implement native biblatex support? See
http://www.lyx.org/trac/ticket/4065 for details what has been thought
already. The implementation part should not be difficult (many
infrastructure parts are already there), what is currently missing is
somebody who understands the interface of biblatex well enough to propose
how to integrate it with LyX. If you are familiar with biblatex and want to
give it a try then I think that many people would appreciate it very much!
I'd be glad to help. Although I'm not a Biblatex expert, I'm using it
quite often so I hope I can be helpful. On the other side, I still don't
know how LyX manages the bibtex and the bibliografies, probably I should
first give a look at it in the code and see if I can figure it out. I added
my email to Cc of #4065.

Best,
Dimitri
Post by Georg Baum
Georg
Loading...