When I started using LaTex, I never bothered about dividing my report into several files. I ended up scrolling down hundreds of lines every time I wanted to make a little change somewhere in the document. It was only later that I learnt how to structure the whole story into different files and therefore omit scrolling the mouse wheel until the finger hurts.
Probaby the best way to structure a report or book is simply by using one file per chapter. In order to include the file as part of your work, use the command \input{(path)\filename}
.
It is also a nice way to generate part of a larger work in order to see where errors are. Also, dividing your work into several files can shorten the PDF generation time if you are only working on one chapter at the time and comment out the rest of the input files. This is far more effective than commenting out whole regions in a document.
arbitblogs
here u have told about how to call the files that are already there…what i want to know is how do u create those very files that u will be calling using the \input command?
is it like any other latex file or are there any changes in the files that will be called?
tom
Hey,
thanks for your comment!
You create those files as any other Latex file (extension is still “tex”). Just put the part inside that you want to take out of your main-file as it is.
E.g. if you want to have one file per chapter, the file would start with \chapter{…}.
All usepackage-packages are automatically available everywhere.
Assuming you have your input-file in a different directory than your main-tex-file, then all paths, e.g. for graphics, have to start from the main-file-directory and not from the input-file-directory. Or briefly, the paths do not have to be changed if you export part of your work to another file.
Luca Beltrame
Just a question… what is the difference between using \input and \include?
tom
Hi,
\include{file} is equivalent to \clearpage \input{file} \clearpage, where \clearpage ends the current page and causes all figures and tables which have appeared so far to be printed.
:-),
Tom
Sven
There is another difference between \input and \include. When using \include you are able to use \includeonly which allows you to keep the whole structure of the document but only prints the content of the files used with \includeonly. Important if you only want to send a certain chapter for example but you still keep the whole table of contents. This can sometimes be important…