I installed Kile 3 and MiKTeX on Windows 10 and can not include any PDF graphics nor Tikz-painted .tex files from subdirectories.

Minimal example:




results in

LaTeX Error: File `RFigures/test.tex' not found.

Same applies to \includegraphics{RFigures/test.pdf}. I tried /, \, //, \\ within the path to the file. Nothing helped. Everything works as long as the to-be-included file is in the same folder as the main.tex. I also renamed all folders directing to my files so as to not include any underscores or spaces.

Here is a screenshot of the structure: Tex file with minimal example. Subfolder with tex file for \input{}.

  • show a screenshot of the folder structure with your main file and the subfolder. – Ulrike Fischer Nov 25 '20 at 17:19
  • Have you tried without the file extensions? Could you rename one of your tex files? I assume your minimal example is the content of Test\test.tex, is that correct? – Teepeemm Nov 25 '20 at 17:44
  • Right now, I can't reproduce my minimal example anymore, it's working. But my thesis still is not able to input anything. I'll try to reproduce... – Sebastian Nov 25 '20 at 17:48

What I did to solve the problem: I opened all files of my project and copied the content into clipboard, saved the content to new files into a new folder and recreated the old folder structure.

Did not change anything qualitatively that I'm aware of. I hope this will not happen again...

Update: I could resolve the issue.

I was producing the .tex and .pdf files using R. There, I was concatenating the folder and filename to the whole path for export using paste(). Unfortunately, paste() always adds a space between strings and thus a file beginning with a space was created. LaTeX was not able to find it, of course. Good software should not allow filenames to begin with spaces, I guess. But the file system NTFS allows it. Even more interesting, copying the file to another folder using Windows Explorer removes the space in the filename! Solution is to use paste0() in R, which does not add spaces between the two strings to be concatenated.

I hope this helps some other people. I'll try to add "when exporting from R" to the question title so that other people find the question easier.

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.