I have article from 10chapters. How I can make automation for pdf compiling? I need to make several different pdfs without one or two chapters. I can everytime just create another maintex and add /ifalse and /fi near \include {chapter} , but i want to do it without touching code everytime. Any ideas?
1 Answer
You can use the package excludeonly
to easily set which chapters are not processed (cf. \includeonly
for the reverse). Just \include
all chapters, the ones listed in \excludeonly
will be ignored. MWE:
\documentclass{report}
\usepackage{excludeonly}
\excludeonly{ch2}
\begin{document}
\include{ch1}
\include{ch2}
\include{ch3}
\end{document}
If you like, you can specify the excluded files at compile time on the command line (adapted from Alex Barnett's (hu)thesis template):
\documentclass{report}
\usepackage{excludeonly}
\typein [\files]{Enter file names to exclude, separated by comma, or `none' to process all files:}
\def\none{none}
\ifx\files\none
\typeout{Including all files.} \else \typeout{Excluding \files.}
\excludeonly{\files}
\fi
\begin{document}
\include{ch1}
\include{ch2}
\include{ch3}
\end{document}