Hi I need to import a file.tex (I cannot move it from this folder) file from a different folder of the main file.

is it possible? how i should do?

  • 4
    \input{relative/path/to/the/other/folder/file.tex} Nov 4 '17 at 15:34
  • Welcome to TeX.SX!
    – Bobyandbob
    Nov 4 '17 at 15:37
  • It doesn't work! I'm using \input{C:/Users/Myname/Desktop/TESA_economics/SES/pluto.tex} The error is: !Missing $ inserted. <inserted tex> $ \input{C:/Users/Myname/Desktop/TESA_economics/SES/pluto.tex} Have you some idea?
    – Marc
    Nov 4 '17 at 15:40
  • Your problem is the space in your user name and also try to avoid special characters such as _ in your file or folder names. Try with a relative path. For example if your main file is in the folder TESA_economics: \input{./SES/pluto.tex} Nov 4 '17 at 15:44
  • @samcarter underscores in file names are not special and not a problem. Nov 4 '17 at 15:52

First, use \usepackage{import}. Then, use \import{Path}{File.tex}. Inside the first braces, use the file path, eg. /Folder/OtherFolder/.../PackageFolder/. In the second one, put the file name(including extensions like .tex).

For example, if the file's relative path is /Parts/Project/file.tex, this is the MWE you would use.


Note: I'm not sure if you use file extension. Try experimenting!

  • Does this answer work for you? If it doesn't, could you please explain why and how I could improve it?
    – Someone
    Mar 31 '20 at 0:21
  • Maybe do ../Parts/Project/?
    – Someone
    Apr 16 '20 at 15:11

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.