[Tex/LaTex] Split thesis chapters into separate files for compilation speed

includeinputsubfilesthesis

I am writing a thesis using a template similar to this template. The main file (dissertation.tex) uses \include{} to include each chapter. I have a large chapter (over 60 pages with 70 images) that takes over thirty seconds to compile and view. I want to split this chapter into two files, chapter4part1 and chapter4part2, so that I can compile and view just the part I am working on.

I have tried using \includeonly{}, \input{} and the subfiles package but have not been able to compile and view quicker than the original. Is there a way to structure my files and commands to quickly compile and view just chapter4part1?

Edit: clarified question to state I want to split one chapter into two files.

Best Answer

You don't mention what kind of thesis you have, pictures and so on, so I'm just going to go with what I got. I'd put the two parts in environments and \excludecomment them using the comment package.

enter image description here

\documentclass{article}

\newenvironment{partone}{}{}
\newenvironment{parttwo}{}{}

\usepackage{comment}
%\excludecomment{partone}
\excludecomment{parttwo}


\usepackage{filecontents}
\begin{filecontents*}{mychapter.tex}
\begin{partone}
Part one of your thesis
\end{partone}
\begin{parttwo}
Part two
\end{parttwo}
\end{filecontents*}

\begin{document}
Tableofcontents
\input mychapter.tex
Chapter 2,3,4,5

\end{document}

For completeness, I will also include something to externalize images (as mentioned in comments to the question). The image below doesn't mean anything. I just wanted to use something with at least some compilation time. You will need to run pdflatex (or whatever engine you require for your thesis) with the shell escape option to make use of this method.

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{external}
\tikzexternalize

\begin{document}
\tdplotsetmaincoords{65}{155}
\begin{tikzpicture}
    [scale=5,
        tdplot_main_coords,
        axis/.style={->,black,very thin},
        vector/.style={-stealth,black,thick },
        curve/.style={black,thin}]
    \coordinate (O) at (0,0,0);
    \draw[axis] (0,0,0) -- (1.2,0,0) node[anchor=north east]{$x$};
    \draw[axis] (0,0,0) -- (0,1.2,0) node[anchor=north west]{$y$};
    \draw[axis] (0,0,0) -- (0,0,1.2) node[anchor=south]{$z$};
    \draw[axis,dashed] (0,0,0) -- (-1.2,0,0) node[anchor=south west]{};
    \draw[axis,dashed] (0,0,0) -- (0,-1.2,0) node[anchor=south east]{};
    \tdplotsinandcos{\sintheta}{\costheta}{45}
    \draw[vector,green!80!black] (0,0,0) -- (.62*\costheta,.62*\sintheta,0) node[above=.27in,right=.03in] {\Large $\rho$};
    \tdplotsetthetaplanecoords{0}
    \tdplotdrawarc[curve,tdplot_rotated_coords,thick,magenta!80,<-]{(O)}{1}{0}{90}{}{}
    \node[magenta!80] at (.8,0,.8) {\Large$\phi$};
    \foreach \angle in {0,30,...,180}
    {
        \tdplotsinandcos{\sintheta}{\costheta}{\angle}%
        \coordinate (P) at (0,0,.62*\sintheta);
        \tdplotdrawarc[curve,very thin]{(P)}{.62*\costheta}{0}{180}{}{}
    }
    \tdplotsinandcos{\sintheta}{\costheta}{180}
    \tdplotdrawarc[curve,thick,cyan!80,->]{(P)}{.8*\costheta}{-90}{260}{}{}
    \node[cyan!80] at (.7,.7,0) {\Large$\theta$};
    \foreach \angle in {0,30,...,360}
    {
        \tdplotsetthetaplanecoords{\angle}
        \tdplotdrawarc[curve,tdplot_rotated_coords,very thin]{(O)}{.62}{0}{90}{}{}
    }
\end{tikzpicture}

\end{document}