Discussion:
lyx 2.0.1 and relative paths to tex files
Oscar Lopez
2011-10-20 14:25:57 UTC
Permalink
Dear LyXers

I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.

I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.

In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure
that the compilation does not break.

Now when I am trying to compile some documents from lyx 1.6.10 I have
found that lyx 2.0.1 stops the compilation saying

LaTeX Error: File `../common/preamble.tex' not found

If I export the latex file using Export->latex (pdflatex) and from a
terminal I run pdflatex:
$pdflatex test.tex

everything is ok!

Attached to this message you can find a minimal example showing the
problem. Look at the file located at test/doc/test.lyx and try to
pdflatex it from lyx and after from a terminal.

Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with
this behaviour and perhaps I am missing something evident.

Best regards
TIA
Oscar
Spyros Stathopoulos
2011-10-20 14:54:32 UTC
Permalink
I think the problem is that LyX does not copy the
"../common/preamble.tex" file over at the temporary build directory
(usually something like /tmp/lyx_tmpdir.XXXX/lyx_tmpbufX/ by default).
I have encountered this kind of behavior before (albeit in a different
case) but I could not find any reasonable solution beyond providing the
full path. It would be nice if there were a solution to this. For your
case, unless you must maintain this kind of directory structure, it
might help you if you put your preamble.tex file in the same directory
as your *.lyx file and use \input{preamble.tex} instead of a relative
path.

Although I am not entirely sure, in LyX 1.6.x there was a way to tell
LyX to use the current WD instead of a temp one.

Spyros
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.
I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure that the
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I have found
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and from a terminal
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing the problem.
Look at the file located at test/doc/test.lyx and try to pdflatex it from lyx
and after from a terminal.
Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with this
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
curtis osterhoudt
2011-10-20 14:59:19 UTC
Permalink
Have you tried NOT including the '.tex' extension on the \input{} command, whether or not you're using a relative path? If I remember correctly, you have to leave that bit off (for which reason I don't know, but that's how TeX expects it). Include everything else, though.

 
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.
I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure that the
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I have found
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and from a terminal
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing the problem.
Look at the file located at test/doc/test.lyx and try to pdflatex it from lyx
and after from a terminal.
Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with this
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
Oscar Lopez
2011-10-20 15:13:50 UTC
Permalink
Post by curtis osterhoudt
Have you tried NOT including the '.tex' extension on the \input{}
command, whether or not you're using a relative path? If I remember
correctly, you have to leave that bit off (for which reason I don't
know, but that's how TeX expects it). Include everything else, though.
Yes, I have tried it and it did not work. TeX I do not know, however,
LaTeX and pdfLaTeX understand perfectly \input{foo.tex} and as I said
before running pdflatex on the tex file exported from lyx-2.0.1 from a
terminal works (with relative path and extension tex to the preamble file)

Thank you very much for your comment Curtis
Best regards
Oscar
Post by curtis osterhoudt
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have
found that
Post by Oscar Lopez
using relative paths to tex files at the lyx preamble does not
work anymore.
Post by Oscar Lopez
I have directory structures where lyx files are at some
directories, bib
Post by Oscar Lopez
files at other, latex preamble commands at othes, and so on ...
The lyx
Post by Oscar Lopez
preamble contains some input commands to take the corresponding
latex
Post by Oscar Lopez
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other
colleagues (for
Post by Oscar Lopez
instance using svn). We always use relative paths in order to
ensure that the
Post by Oscar Lopez
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I
have found
Post by Oscar Lopez
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and
from a terminal
Post by Oscar Lopez
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing
the problem.
Post by Oscar Lopez
Look at the file located at test/doc/test.lyx and try to
pdflatex it from lyx
Post by Oscar Lopez
and after from a terminal.
Please has something changed regarding the treatment that lyx
gibes to
Post by Oscar Lopez
absolute versus relative paths? Hope not! I am completely
puzzled with this
Post by Oscar Lopez
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
Oscar Lopez
2011-10-20 15:07:37 UTC
Permalink
Post by Spyros Stathopoulos
I think the problem is that LyX does not copy the
"../common/preamble.tex" file over at the temporary build directory
(usually something like /tmp/lyx_tmpdir.XXXX/lyx_tmpbufX/ by default).
I have encountered this kind of behavior before (albeit in a different
case) but I could not find any reasonable solution beyond providing the
full path.
I do not know! As far as I know before lyx 2.0.1 using relative paths
was the way to ensure to share projects that use many directories to
organize the information. I have been using lyx since 1997 and never
have a problem with this. In fact, I have been used to work in this way
and it even worst I teach many people to do so.
Post by Spyros Stathopoulos
It would be nice if there were a solution to this.
sure!
Post by Spyros Stathopoulos
For your
case, unless you must maintain this kind of directory structure, it
might help you if you put your preamble.tex file in the same directory
as your *.lyx file and use \input{preamble.tex} instead of a relative
path.
This solution will be a nightmare! I got people at my institute to move
from word to lyx and we have created many svn projects, books and many
other things that rely on the fact that lyx can understand relative
paths and in this way we can work all together. Hope there is something
more evident.

I cannot believe that this version of lyx is going to drop the support
to relative paths I put an example with a tex file, but what about child
documents, graphic files and others that until now I didn't tested with
lyx 2.0.1.
Post by Spyros Stathopoulos
Although I am not entirely sure, in LyX 1.6.x there was a way to tell
LyX to use the current WD instead of a temp one.
Here using lyx-1.6.10 with the test I sent everything is ok. As far as I
am concerned it does not require to tell lyx anything

Thanks for your comments
Best regards
Oscar
Post by Spyros Stathopoulos
Spyros
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.
I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure that the
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I have found
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and from a terminal
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing the problem.
Look at the file located at test/doc/test.lyx and try to pdflatex it from lyx
and after from a terminal.
Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with this
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
Spyros Stathopoulos
2011-10-20 15:21:24 UTC
Permalink
Child documents work OK, just Insert -> File -> Child Document. So do
graphics etc. Just insert them regularly from the menus. The problem
with other inputs, as far as I am concerned, is that the original
directory structure is not recreated in the temporary build directory.
I do not know if there is a way to manually add dependencies to a
document so that LyX can pick the files when building the pdf/ps.
I think the problem is that LyX does not copy the "../common/preamble.tex"
file over at the temporary build directory (usually something like
/tmp/lyx_tmpdir.XXXX/lyx_tmpbufX/ by default). I have encountered this kind
of behavior before (albeit in a different case) but I could not find any
reasonable solution beyond providing the full path.
I do not know! As far as I know before lyx 2.0.1 using relative paths was the
way to ensure to share projects that use many directories to organize the
information. I have been using lyx since 1997 and never have a problem with
this. In fact, I have been used to work in this way and it even worst I teach
many people to do so.
It would be nice if there were a solution to this.
sure!
For your case, unless you must maintain this kind of directory structure,
it might help you if you put your preamble.tex file in the same directory as
your *.lyx file and use \input{preamble.tex} instead of a relative path.
This solution will be a nightmare! I got people at my institute to move from
word to lyx and we have created many svn projects, books and many other
things that rely on the fact that lyx can understand relative paths and in
this way we can work all together. Hope there is something more evident.
I cannot believe that this version of lyx is going to drop the support to
relative paths I put an example with a tex file, but what about child
documents, graphic files and others that until now I didn't tested with lyx
2.0.1.
Although I am not entirely sure, in LyX 1.6.x there was a way to tell LyX to
use the current WD instead of a temp one.
Here using lyx-1.6.10 with the test I sent everything is ok. As far as I am
concerned it does not require to tell lyx anything
Thanks for your comments
Best regards
Oscar
Spyros
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.
I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure that the
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I have found
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and from a terminal
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing the problem.
Look at the file located at test/doc/test.lyx and try to pdflatex it from lyx
and after from a terminal.
Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with this
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
Stephan Witt
2011-10-20 15:45:07 UTC
Permalink
Post by Spyros Stathopoulos
Child documents work OK, just Insert -> File -> Child Document. So do
graphics etc. Just insert them regularly from the menus. The problem
with other inputs, as far as I am concerned, is that the original
directory structure is not recreated in the temporary build directory.
I do not know if there is a way to manually add dependencies to a
document so that LyX can pick the files when building the pdf/ps.
As Oscar said it's all about files referenced in LyX's preamble.
This is more like using ERT than like Insert -> File -> Child Document.
Actually I don't know how to solve that, but IMHO the problem is clear.

Oscar, I think you should file a bug in LyX's trac-system.
http://www.lyx.org/trac/newticket

I hope, you are able to go back to 1.6.10 until this is solved.

Regards,
Stephan
Post by Spyros Stathopoulos
I think the problem is that LyX does not copy the "../common/preamble.tex"
file over at the temporary build directory (usually something like
/tmp/lyx_tmpdir.XXXX/lyx_tmpbufX/ by default). I have encountered this kind
of behavior before (albeit in a different case) but I could not find any
reasonable solution beyond providing the full path.
I do not know! As far as I know before lyx 2.0.1 using relative paths was the
way to ensure to share projects that use many directories to organize the
information. I have been using lyx since 1997 and never have a problem with
this. In fact, I have been used to work in this way and it even worst I teach
many people to do so.
It would be nice if there were a solution to this.
sure!
For your case, unless you must maintain this kind of directory structure,
it might help you if you put your preamble.tex file in the same directory as
your *.lyx file and use \input{preamble.tex} instead of a relative path.
This solution will be a nightmare! I got people at my institute to move from
word to lyx and we have created many svn projects, books and many other
things that rely on the fact that lyx can understand relative paths and in
this way we can work all together. Hope there is something more evident.
I cannot believe that this version of lyx is going to drop the support to
relative paths I put an example with a tex file, but what about child
documents, graphic files and others that until now I didn't tested with lyx
2.0.1.
Although I am not entirely sure, in LyX 1.6.x there was a way to tell LyX to
use the current WD instead of a temp one.
Here using lyx-1.6.10 with the test I sent everything is ok. As far as I am
concerned it does not require to tell lyx anything
Thanks for your comments
Best regards
Oscar
Spyros
Post by Oscar Lopez
Dear LyXers
I have recenty updated my lyx version to lyx 2.0.1 and I have found that
using relative paths to tex files at the lyx preamble does not work anymore.
I have directory structures where lyx files are at some directories, bib
files at other, latex preamble commands at othes, and so on ... The lyx
preamble contains some input commands to take the corresponding latex
preamble, i.e.
\input{../common/preamble.tex}.
In this way I can share project directories with other colleagues (for
instance using svn). We always use relative paths in order to ensure that the
compilation does not break.
Now when I am trying to compile some documents from lyx 1.6.10 I have found
that lyx 2.0.1 stops the compilation saying
LaTeX Error: File `../common/preamble.tex' not found
If I export the latex file using Export->latex (pdflatex) and from a terminal
$pdflatex test.tex
everything is ok!
Attached to this message you can find a minimal example showing the problem.
Look at the file located at test/doc/test.lyx and try to pdflatex it from lyx
and after from a terminal.
Please has something changed regarding the treatment that lyx gibes to
absolute versus relative paths? Hope not! I am completely puzzled with this
behaviour and perhaps I am missing something evident.
Best regards
TIA
Oscar
Bert Lloyd
2011-10-20 17:14:51 UTC
Permalink
I have found command line and shell scripts to be the best, though
admittedly imperfect, options:

$ cp filename.lyx filename-mytemp.lyx
$ lyx -e latex filename-mytemp.lyx
$ pdflatex filename-mytemp.tex
$ cp filename-mytemp.pdf filename.pdf
$ rm filename-mytemp*

I wish i knew of a way to put a shortcut into LyX that said, "Do the
above, using the current file as -filename-"

HTH

Loading...