I wrote an document, that inputs another .tex file:


\title{My Title}

Now, when I run compiling this document, TexShop says:

! LaTeX Error: File `../../../_def.tex' not found.

I think, the problem is, that the compiler tries to resolve the relative path from its own folder, but I defined it relatively to the source file, which I quoted above. Is this the reason?

How can I fix I - without using absolute paths.

Thanks for your help!

  • input paths in tex are always relative to the working directory of the program, not to the directory the document is in, so it is simplest if you arrange to cd to the document folder first. Also your document would be far more portable if it just had \input{_def} and you arranged that the folder containing that file is in your TEXINPUTS path. – David Carlisle Dec 6 at 15:44
  • Hey David, thanks for your reply! Unfortunately, I understand not everything what you mean.. How should I "cd to the document folder" within TexShop?! DO I have to define a system wide environment variable to fix this issue finden the _def file? Should the TEXINPUTS path point to the folder that the _def file contains? – mrbela Dec 6 at 18:46
  • I just downloaded TexStudio for other features.. Is there a possible easier way to fix my problem? Thank you! – mrbela Dec 6 at 18:59
  • I don't use texshop or texstudio so i can't say how to configure them, both texlive and miktex have default input paths so if (on texlive) you put the file in ~/texmf/tex/latex/anything/_def.tex then any of your latex documents could include it as \input{_def} – David Carlisle Dec 6 at 19:01
  • Alright, thanks! If one want to use TexStudio it works 'built in'. It finds the -relative- linked tex-files 'automatically'. – mrbela Dec 6 at 19:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.