TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a semi-long report with ten-ish sections - in other words, just short enough so that it's practical to keep it all in one file without getting lost.

However, for compiling it'd be extremely useful to be able to skip some sections and get a shorter version for reading and discussion with collaborators.

I believe that I have been told that it is possible to compile only some sections of a document by using a symbol in relation with the \sections to be skipped, and that this is possible without chopping up the document in smaller pieces and cleverly using \include, but I'm unable to find it despite massive googling.

Does this "skip sections when compiling" sound familiar? I'd be very greatful if someone could tell me what the command is? :)

share|improve this question
I think that ignoring-chapter-easily describes what you want- the answer given is for chapters but it's exactly the same idea (I think); let us know – cmhughes Dec 1 '12 at 0:46

This answer might not be the general setup you are looking for, but it doesn't use \include and requires minimal edits in your file.

If you define a \newif for each section that you have (say secOne, secTwo etc) and put the whole contents of each section between those "ifs", you can select which sections are compiled by setting them to true or false at the beginning of your document. For example (not a MWE, it just illustrates the idea):


Contents of section one will be compiled

Contents of section two will not be compiled
share|improve this answer
What about using \if TT before the sections you want and \if TF before the ones you don't want? No need to define a conditional for each section. – egreg Dec 1 '12 at 11:28
@egreg: Thanks, I wasn't aware of \if TT. On the other hand, if you have the conditionals for each section you will have a well-defined location (in the beginning of the file) for setting the choices, instead of going through the file and changing the \if TT's etc. It will save some time. – Mafra Dec 1 '12 at 12:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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