1

I want to use the command \include to include a .tex file which is not in the same directory as the main .tex file.

Is this possible? I have not found any information about it, and this:

\include{/myuser/Desktop/mydir/mytex}

does not work.

Note that I am under Debian Wheezy.

  • You should use the universal / operator for folder designation, not \. – Werner Jan 30 '16 at 18:52
  • 1
    No, for security reasons, TeX is disallowed writing in directories above the current one or those specified with an absolute path. Would you like it to write in /etc? – egreg Jan 30 '16 at 18:55
  • to expand on egreg's answer: relative paths are fine. So you can do things like include{chap/one}. – Mark Jan 30 '16 at 18:59
  • @egreg Does that mean I could \include .tex files from directories below the main one by using a relative path? That would do the trick. I am going to try it, thanks. – D1X Jan 30 '16 at 19:00
  • Do you actually want to write or just read? On windows I have various bits of code I am working on in a path (code) at the same level as various projects - you can easily input \input{../code/sometexfile} where my project is at the same level as a universal code folder – Aubrey Blumsohn Jan 30 '16 at 19:34
1

As egreg has pointed out, TeX is disallowed writing in directories above the current one or those specified with an absolute path.

Relative paths are alowed, so we could do it by using

\include{mydir/mytex}

Provided mydir is located in the same directory as the main .tex file.

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.