I am writing my Thesis using the memoir class. To keep my main .tex file fairly short I use the \input command to compile the chapters. This also helps when I only want to send a chapter on to my supervisor for reviewing as I can % out the \input of the chapter I don't want to compile. My issue is though that when, for example, only send on one chapter it will automatically be renumbered Chapter 1 even though it could be Chapter 4 in context of all the other chapter.

Good time for some background info. My supervisor does not use LaTeX so I can't just send him the TeX files. I send a pdf document which is why the problem arises. It's a small issue but can lead to some confusion as to what chapter I'm sending.

I don't know if I can do a MWE that would be helpful but I hope I have described my issue enough. What I ideally want is some small bit of code that I can use to temporally renumber the Chapters when only compiling some of them?

  • 3
    Use \include instead of \input and compile the file. After that in the main file add in the preamble \includeonly{chapter1} (where chapter1.tex is the chapter you want to include) and compile again. Jan 5, 2015 at 11:22
  • Another workaround is putting the chapter headers in the main file, outside the \input. Just to be clearer, I mean so that your main file would read \chapter{Introduction} \input{chapter1-contents.tex} \chapter{State of the Art} \input{chapter2-contents.tex} ... Jan 5, 2015 at 11:25
  • 3
    This usage is exactly why latex has \include and \includeonly not only will that give the correct number it will allow \ref to things in the omitted chapters, something that will not work if you simply comment them out and use \input Jan 5, 2015 at 12:24
  • @karlkoeller if you wish to add your comment as an answer I'll accept it as a solution.
    – gman
    Jan 5, 2015 at 22:42

1 Answer 1


LaTeX provides the commands \include and \includeonly for this purpose.

First of all, replace all your \input commands with \include in your main file. Then, supposing that chapter4.tex is the chapter you want to print, add this line in your main file preamble.


Now compile your file and, if any, your bibliography, your index, etc.

At this point, uncomment the above line in your main file and recompile.

You will notice that you get only chapter4.tex printed, with all correct references, citations, etc.

For further reading, I suggest When should I use \input vs. \include?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .