1

I have the main tex which include tex files.

\begin{document}
\include{chap1}
\include{chap2}
\include{chap3}
\include{chap4}
\include{chap5}
\end{document}

How can I make a one pdf without for example chap3. I need macro with which I can make various pdf, without some chapter or with all chapter. Maybe you have any ideas?

Thanks.

gman
  • 1,807
Mantas
  • 265
  • Welcome to TeX.SX! \includeonly{chap1,chap2,chap4,chap5} for example will exclude the chap3 -- use it in the preamble only. –  Nov 10 '15 at 08:28
  • I know this command, but is there any option to automatize everything. Something like a generation menu, where i can choose what content I want in my pdf. – Mantas Nov 10 '15 at 08:32
  • Your comment is unclear. –  Nov 10 '15 at 08:39
  • How about arara? See my answer to http://tex.stackexchange.com/questions/31334/how-to-create-individual-chapter-pdfs – cmhughes Nov 10 '15 at 08:40
  • 1
    @Mantas latex can not have a menu, it is just a text based programming language: it does not have any GUI at all. Obviously any editor or tool that is writing tex files could have such a menu but you have given no information about what editor or operating system you are using (and if the question is purely about programming an editor dialog, it is probably off topic here) – David Carlisle Nov 10 '15 at 09:01
  • 2
    Why don't you just comment one or the other of the lines including a chapter? It takes one second and it really makes it easy and completely "automatic" since you do it by hand. – Xavier_B Nov 10 '15 at 09:45

1 Answers1

2

I would use the \includeonly{} command:

   \documentclass{article}
   %include relevant packages
   \includeonly{%
   chap1,
   chap2,
   %chap3,
   chap4,
   chap5%
   }
  \begin{document}
  \include{chap1}
  \include{chap2}
  \include{chap3}
  \include{chap4}
  \include{chap5}
  \end{document}

This way by commenting/decommenting selectively your files in the includeonly list, you would be able to generate a pdf only including the relevant chapters.

For instance, in the example provided, only chapters 1,2,4, and 5 are produced in the output.

Moriambar
  • 11,466