0

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?

11
  • 4
    \input{relative/path/to/the/other/folder/file.tex} Commented Nov 4, 2017 at 15:34
  • Welcome to TeX.SX!
    – Bobyandbob
    Commented Nov 4, 2017 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
    Commented Nov 4, 2017 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} Commented Nov 4, 2017 at 15:44
  • @samcarter underscores in file names are not special and not a problem. Commented Nov 4, 2017 at 15:52

1 Answer 1

1

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.

\documentclass{...}
...
\usepackage{import}
...
\begin{document}
    ...
    \import{/Parts/Project/}{file.tex}
    ...
\end{document}

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

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

This site is temporarily in read-only mode and not accepting new answers.

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