I’m due to start my dissertation and saw a few people recommend the technique of having one master file which links to each chapter which in itself is saved as a separate file. If this is optimal, how do I set it up?

  • 3
    Yes, this is common. You just put the text and everything in a separate file. If it's an entire chapter you can include it with the macro \include (this also starts a new page), if it shouldn't start a new page, you can use \input. \input can be nested, but you can't \include a file from within a file that is \included.
    – Skillmon
    Sep 17 '19 at 18:20
  • 3
    It is common but also trivial to change after you have started, if it is all in one file you can take the text of a chapter and replace it by \include{somefile} and put the text into somefile.tex. Conversely if you have it set up as multiple files and want to make it a single one, just remove the \include statement and replace it by the contents of the file you were including. Sep 17 '19 at 18:42
  • 1
    Related: When should I use \input vs. \include? Nov 7 '19 at 0:59

So how to set it up has already been answered by Skillmon or David Carlisle. So let me just go over the implicit part of the question

If this is optimal

Is it optimal to save each chapter of a document as a separate file?


  • Complex management of many files

With the splitting of the document one has to take care of a management of inevitably many files.

  • Content may suffer from independent editing

Independent editing of chapters can disrupt the reading flow of the work.

Transitions between chapters may suffer.

  • Difficult replacement of an expression

If you want to replace a single word or expression within a document, you have to do this for all separate files individually.

The effort of a Find and Replace is thus increased by the number of separate files that are used.

  • Missing chapter due to include mistake

There can be some include mistakes. As an example, one scenario is sufficient for us.

Two files were confused because of their similar titling and now one chapter is in the wrong place.


  • Clarity of presentation and clearer structure of texts, figures, bibliography, etc.

Due to the increased clarity, you can work more productively.

  • Easy editing of small files

Smaller files can be edited more easily if on the one hand the scrolling to the corresponding place is omitted and on the other hand the other chapters can no longer serve as distraction.

  • Facilitate collaborative work

Both individual files are sent faster to colleagues and require less memory on their computer and the editing by the colleague of individual chapters facilitates the editing of the work.

  • Move or comment out a chapter more easily

Because the chapters in our master file are inserted within one line, moving / commenting out / deleting a chapter is easier.

You only have to handle one line instead of several paragraphs.

  • Reusability

By separating the contents into individual files, they can also be easily reused.

For example, a small requirement specification is created for a preliminary discussion of a thesis. As soon as the actual thesis is written, chapters from the preliminary work can be added without further difficulties by simply including them.

  • Separating logic from content

As in many other areas of science, it makes sense and is usual to separate the logic from the actual content in order to operate on both independently of each other.

The master file serves as a container for our logic and organization.

  • Text Completion (suggested by @cfr)

Some editors quit offering completions if a single file exceeds a certain number of lines. (At least, Kile does.)

  • Working on selected sections (suggested by @cktai)

With \includeonly{} it is possible to add and remove chapters in the output file, but keep the page numbers, chapter numbers, and table of contents as if those chapters were still present.

This is very useful, e.g. for a dissertation, when you need to show individual chapters to your supervisor, but they get easily confused as to which chapter they are looking at.

If I have forgotten anything, I assume, please add your points.

If you can refute a point and it is therefore not an advantage or disadvantage, please let me know or just edit this post.

Please do the same for gaps within the content and useful information.

  • 1
    Some editors quit offering completions if a single file exceeds a certain number of lines. (At least, Kile does.) Sync can be more complicated back to source with multiple files. I don't really agree about versioning. I don't deny it can happen, but I'm not sure multiple files makes it worse. Either up remember to commit and refresh or you don't. It isn't as though you have to commit or refresh each file individually.
    – cfr
    Nov 7 '19 at 2:25
  • 3
    using \includeonly{} you can add and remove chapters in the output file but keep the pagenumbers, chapternumbers, and table of contents as if these chapters still exist. This is very useful for a dissertation if you need to show individual chapters to your supervisor, but they get easily confused as to what chapter they are looking at.
    – cktai
    Dec 28 '20 at 3:03

How do you set it up: create different files and include them using \include{filename}, without the extension. If you want to add folders, simply include them in the filename. A simplified version of my dissertation mainfile looks like this:





As you can see, I put all the chapters in one folder, and the preamble info, bibliography, and glossary entries in another folder. Adding all the preamble noise in separate files keeps the preamble clean and makes it easier for me to recognise what everything is doing.

In the preambles, I have used \input because I always want to include those files. In the document itself, I have used \include. That way, if you only want to compile a single document, you can use the \includeonly{} command in the preamble. If you use \includeonly{chapters\chapter1}, it will only compile and show that chapter but using the pagenumbers and creating the table of contents as if the other chapters also exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.