[Tex/LaTex] Some problems with “input” command


When inputting two sub-files to a main LaTex-file by the "input" or "include" command, I encountered some problems. I will describe my problems through a series of questions as follows (PS: I apologize if the following questions have already been addressed.):

1, Should I use the package "standalone" when I use the "input" command? When I tried to compile my main tex-file containing "input" command I found that it is necessary to use the the package "standalone" for compiling the main tex-file successfully. I wonder whether the "input" command can be used in a main tex-file unconditionally.

2, Is it necessary to put the two sub-tex-files (i.e., file1.tex and file2.tex) in the folder where the main tex-file is situated? That is to say, can sub-tex-files and main tex-file be placed in separate folders?

3, Should I load all packages needed for all sub−files into preamble of the main tex-file?

4, When using \input{my tree diagram}, with two blanks in the file name, in the main tex-file, the compiler does not work. I change the file name without any blanks, and then the main tex-file can be compiled successfully. My computer system is OS X, and my TeX editor is Sublime Text 3 + LatexTools. Are there any good ways to solve this "blank interrupting" problem?

Any suggestions and comments are appreciated. Thank you.

Best Answer

It is best to ask one question per post but

(1) No, \input is a basic latex command unrelated to standalone or any other package.

(2) No, you can put them anywhere on the input path or use \input{path/to/folderwith/file1} or whatever you need

(3) Yes

(4) By far the best way is not to put spaces in filenames but if you really must then \input{"my tree document"} will work.