Here is a complete example of the input/include command at work:
The example consists of 3 files in a folder structure as follows:
[Parent Folder]
|
+-- file1.tex
|
+-- fig.jpg
|
+-- [folder]
|
+-file2.tex
fig.jpg is just an ordinary jpg image file. The contents of file1.tex are as follows:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\input{folder/file2.tex}
\end{document}
Note the inclusion of the (relative) path as well as the filename of file2.tex.
The contents of file2.tex are
\includegraphics{fig.jpg}
Note that file2.tex does not have its own preamble, document class, \begin{document} etc.
Think of \input as having a similar effect to you manually copying and pasting whatever is in file2.tex into file1.tex: no need to include anything you wouldn't want to copy in this fashion. Following through this copying/pasting logic: note also that the path to fig.jpg needs to be relative to file1.tex, not file2.tex. Since fig.jpg is in the same folder as file1.tex this means that we don't have to specify any path.
Saving this file/folder structure and compiling file1.tex results in a document with fig.jpg included in it.
child1.tex,child2.texfiles with respect tomaster.tex? What is the preamble inchild.texfiles and are they self-compilable with their own\documentclass{}? TeX UK faq website has some excellent information on it – texenthusiast Jul 09 '13 at 10:23\input{}, you could write path to the file, e.g., if you have your tex file in the forder WORK, but there are subfolders CH1, CH2, etc., use\input{CH1/sec1.tex}and so on! Cheers. – Dox Jul 09 '13 at 13:38I inserted the above one, but didn't work. My file name is oscillon13061 and tex file name is oscillonsource.tex.
– Complex Guy Jul 09 '13 at 15:45\input{oscillon130613/...}to\input{../oscillon130613/...}...is the Unix shortcut for the parent folder relative to your working directory. – JBantje Jan 14 '15 at 16:04