Okay, I've puzzled over this for a while and I can't work it out.

I have a document with several chapters, using the memoir class. I've separated each chapter into separate files, and I'm including them using \input.

I did this because at times I may want to produce a file with just chapter 2, or just chapter 3 and not the others. But when I do this, the chapters get renumbered.

How can I make my file customizable, so if I want to, I can make a pdf with just Chapter 2, or just Chapter 3, and no 1?

2 Answers 2


You should use \include instead of \input, and then in the preamble say with \includeonly which of the included files you want in your pdf file, like this:


The first run(s) of pdflatex should be done without the \includeonly in order to get all the references right.


On the off-chance that you prefer to \input your chapters rather than \include-ing them, then the solution involves nothing more than redefining the chapter number prior to selectively input-ing your chapters. If that's the path you want to take then here's all you need to do:

\usepackage{calc}  % for the arithmetic below

  \setcounter{chapter}{#1 - 1}%

%  \chapternumber{1}\input{chapter1}

I'll leave it to you to work out why the arithmetical adjustment is warranted.

You must log in to answer this question.

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