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

1
  • Your example is a little bit confusing. You use \section, the titles are Chapter ... – user31729 Aug 28 '14 at 6:26
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}
1
  • 2
    You need \usepackage{excludeonly} for this – user31729 Aug 27 '14 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.