This article is based on Part 7 of the LaTeX tutorial series, LaTeX Tutorial pt 7 - Longer Documents, which explains how to create larger documents. For writing longer documents, the document type of the document, written with the “\documentclass{}” command, should be either book or report class.
When writing longer documents, the root document (main document) should be made up of several smaller separate files, so the document is more organized. The root document should contain the basic setting commands for the document, for example class, package and title.
The rest of the document can be divided into chapters, and each chapter is a separate file, created by pressing the top left hand folder button. In each new file, the commands should start with a “\chapter{Chapter Title}” command, rather than a “\begindocument” command, and no end command is necessary.
The text for each chapter should be added under the chapter start command, and broken up into sections if necessary.
To compile the chapters into the root document, use the “\input{file name}” command. An alternative method to compile the chapters together is using the “\include{file name}” command, which starts each chapter on a separate page.
To create a table of contents, use the command “\tableofcontents”, and LaTeX will create a table of contents based on the titles of the chapter files. How detailed the table of contents is can be broken down into levels- for example level zero would only include chapter titles, level three includes all of level two as well as subsections, and so on. In order to specify this, use the command “\setcounter{tocdepth}{level}” in the preamble.
When writing longer documents, graphics can be compiled into a separate folder. These graphics can then be added back into a chapter, by adding the commands “\usepackage{graphicx}” and “\graphicspath{{folder name}}” on separate lines in the preamble. In the chapter where the graphic should be placed, write the command “\includegraphics{graphic name}”.
留言