## page was renamed from Latex/LargeDocuments ## page was renamed from computerLatexBookB #acl Known:read,write,admin,delete,revert All:read = LaTeX-files for large documents = Here is [[../LargeOld|an old version of this page]] This is a description of a folder and file structure for documents such as books, theses, reports and similar with several chapters. The idea is that you should be able to work on one chapter at a time and still get all numbering and cross-referencing correct all the time. The proposed structure might seem complex, with files on different levels, but it's probably not possible to simplify and still be able to tex the whole book and individual chapters without having to switch between the two and edit the text. The important commands to acheive this are {{{\include{} }}}and {{{\includeonly{}}}}, which are described in [[https://en.wikibooks.org/wiki/LaTeX/Modular_Documents#Using_.5Cincludeonly|the LaTeX wikibook]] or the LaTeX book. The book in the example is supposed to describe the capitals of Europe and hence the main folder is called {{{ Capitals}}}, and the main file {{{Capitals/Capitals.tex}}}. There are two chapters so far, and therefore two sub-folders, which are named {{{Madrid}}} and {{{London.}}} Note that they are not named {{{chap1}}} and {{{chap2}}}. This is so you can easily rearrange the order of the chapters without having to change names. There is also another subfolder with the name {{{Frontmatter}}}, intended for title pages, forewords, Table of Contents etc. Additional comments come after the descriptions of the files. {{{ Capitals/ }}} contains a tex-file, {{{Capitals.tex.}}} * Capitals.tex: {{{ \documentclass{LTHthesis} \newcommand\thisdir{.} % Will be changed in the chapters \newcommand\figdir{\thisdir/figures} % See comment below \addbibresource{europe.bib} % and other preamble commands \includeonly{ % For the layout, see comments below. Frontmatter/Frontmatter, London/London, Madrid/Madrid, } \begin{document} \include{Frontmatter/Frontmatter} \include{London/London} \include{Madrid/Madrid} \end{document} }}} {{{Capitals/London/}}} contains at least one tex-file, {{{London.tex}}}, and possibly a subdirectory {{{figures}}}. * London.tex: {{{ \renewcommand\thisdir{London} \chapter{London, the City that Lost an Empire} \label{chap:London} This chapter contains a thorough description of London. \begin{figure} \includegraphics{\figdir/ImageOfLondon} \caption{London Skyline} \end{figure} }}} {{{ Capitals/Madrid/ }}} contains at least one tex-file, {{{Madrid.tex}}} and possibly a subdirectory {{{figures}}}. * Madrid.tex: {{{ \renewcommand\thisdir{\topdir/Madrid} \chapter{Madrid, where the Diagonals Cross} \label{chap:Madrid} This chapter contains a thorough and exhaustive description of Madrid. \begin{figure} \includegraphics{\figdir/RoyalPalace} \caption{The royal palace of Madrid} \end{figure} }}} {{{Capitals/Frontmatter/ }}} is used for title pages, Table of Contents etc. Typically: {{{ \begin{titlepages} \author{...} \title{...} % other entries for the title pages \end{titlepages} \chapter*{Acknowlegements} % ... \chapter*{Abstract} % ... \tableofcontents }}} The different parts of Frontmatter may be in separate files, but in this case, use {{{\input}}}, not {{{\include}}}. == Some comments == The statement {{{\includeonly ...}}} has this special layout so that it will be easy to comment out all chapters except the one you specifically want to work with. You can then type {{{latex Capitals}}}, and only the desired chapter will be processed, but all numbering and cross-references will still be correct. Both Texmaker and Texstudio have the possibility to specify a 'Master File', in this case {{{Capitals.tex}}}, such that even if you work with {{{London.tex}}}, the build command will be for the main file, {{{Capitals.tex}}} {{{\figdir}}} as defined in {{{Capitals.tex }}} above presumes that each chapter has a subfolder with the name {{{figures,}}} where the figures for each respective chapter are located. There are other possible layouts and you can change the definiton of {{{\figdir}}} to fit.