Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
    
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Kurt Dec 1 '12 at 0:05
    
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
add comment

1 Answer

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):

\newif\ifsecOne
\newif\ifsecTwo
\secOnetrue
\secTwofalse


\ifsecOne\secOnetrue
Contents of section one will be compiled
\fi

\ifsecTwo\secTwotrue
Contents of section two will not be compiled
\fi
share|improve this answer
2  
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
add comment

Your Answer

 
discard

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.