In ShareLaTeX, I have the following folder/file structure:

- DIR1
 * FILE1
 * DIR2
      * FILE2

- DIR3
 * FILE3 (Preamble.tex)
 * DIR4 (Fonts)
     * DIR5
         * FILE5

(DIR1 and DIR3 are in the main DIR)

I need FILE1 and FILE 2 to access FILE3 inside DIR3. FILE3 accesses folders and files in DIR4. In FILE1, I can do \input{../DIR3/FILE3} which will work only if FILE3 has \setmainfont[Path=../DIR3/DIR4/DIR5]{FILE5}

However, if in FILE2 I do \input{../../DIR3/FILE3} I get an error that says FILE5 cannot be found. If I change \setmainfont[Path=../../DIR3/DIR4/DIR5]{FILE5} in FILE3, FILE2 complies fine but now FILE1 does not compile.

I looked at the documentation for relative and absolute file paths but this seems to be a different issue. It seems to be FILE3 assumes the working directory of whatever file calls it, instead of its current directory.

Any suggestions?

1 Answer 1


ShareLaTeX takes all paths to be from the 'root' directory of the project. It should work if:

  • In FILE1 you write \input{DIR3/FILE3}
  • In FILE2 you write \input{DIR3/FILE3}
  • In FILE3 you write \setmainfont[Path=DIR3/DIR4/DIR5]{FILE5}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .