0

I understand that there is an \excludeonly{xyz} command where xyz is a LaTeX file name (explained here). This excludes the specified file(s) from compilation. My question is if there is equivalent command for xyz being a specific section within a file. So lets say my source latex file (say source.tex) is:

\usepackage{....}

\begin{document}
\section{Chapter 1}
...

\section{Chapter 2}
...

\section{Chapter 3}
...

\section{Chapter 4}
...

\end{document}

and my compiled file (say thesis.tex) is:

\documentclass{article} 
\input{source}

How can I exclude, say Chapter 2, from the compilation process.

Apologies if this has been answered before (I couldn't find it).

gaurav
  • 43
  • Your example is a little bit confusing. You use \section, the titles are Chapter ... –  Aug 28 '14 at 06:26

1 Answers1

1

You must have separate tex files for each section. Then it is easy for you to exclude chapter2 section. If your code is drawn as shown below then chapter2 tex file will not be compiled.

\documentclass{article}
\usepackage{excludeonly}
\excludeonly{chap2}
\begin{document}
\include{chap1.tex}

\include{chap2.tex}

\include{chap3.tex}

\include{chap4.tex}

\end{document}
murugan
  • 1,669