1

I have the following structure (folders in italics)

  • master.lyx
  • parts
    • mst
      • mstCh1.lyx
      • preamble
        • packages.tex
        • preamble.tex
    • p1
      • p1Intro.lyx

Each lyx file imports preamble.tex located in parts/mst/:

  • master.lyx using \subimport{parts/mst/preamble/}{preamble}
  • mstCh1.lyx using \subimport{preamble/}{preamble}
  • p1Intro.lyx using \subimport{../mst/preamble/}{preamble}

It allows me to compile the files either on their own or from master.lyx, where mstCh1.lyx and p1Intro.lyx have been added as Child Documents.

preamble.tex contains among other things import{./}{packages.tex}

For strange reasons, everything works as expected except p1Intro.lyx which can not be compiled due to

\subimport{../mst/preamble/}{preamble} LaTeX Error: 'preamble.tex' not found.

even though the relative path is correctly set.

Using currfile does not help since the returned folder is always empty...

Any idea?

Edit After some tests I did this morning, it seems the relative path .. is not correctly interpreted. I just sent an email to the package's author, and update this post accordingly.

1

I am using a workaround and will edit this answer with the answer of the package's author.

Instead of using a .. in the \subimport command, I am simply using a symbolic link to the folder I am trying to reach.

In my current configuration :

  • I have created a symbolic link called preamble in the folder p1 pointing to ../mst/preamble with the shell command (Linux): `ln -s ../mst/preamble/ preamble
  • I am importing the preamble.tex file in p1Intro.lyx with \subimport{preamble}{preamble} which is now working! Moreover, it allows me to use the same command as the one used in the file mstCh1.lyx.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.