This question already has an answer here:

I am making a template for several books. I have a mainfile which includes the .tex files for my chapters. For each book, some chapters are always almost the same except for a few subsections.

How can I define a macro or something to only include this subsection under a specific condition?

It should be like this pseudo code:

  type=(A,C) <-- defined at the beginning of each book


  if type=B, include: \section{first} 
  \section{second} <-- this is included always
  if type=B,C, include: \section{third}
  if type=A, include: \section{fourth}

so only sections second, third and fourth would appear in this particular case. Any idea how to realize that?

marked as duplicate by Martin Schröder, Xavier, Werner, Thorsten, Stefan Kottwitz Jul 10 '13 at 6:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Please, take a look at tex.stackexchange.com/questions/33576/… – user13907 Jul 4 '13 at 10:08
  • Does the linked question help? – Marco Daniel Jul 4 '13 at 17:11
  • Why not simply a \includeonly{filename1,filename2,...} in the preamble? – Fran Jul 7 '13 at 2:03
  • Thank you Papiro, the linked question is really helpful! – Kathiieee Jul 7 '13 at 20:13