0

Hello I am trying to write my thesis to include different chapters my master tex document looks like this:

\documentclass[11pt a4paper]{report}

\usepackage[left=4.0cm, right=1.5cm, top=1.5cm, bottom=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{grffile}
\usepackage{amsmath}
\usepackage{fixltx2e}
\usepackage{textgreek}
\usepackage{setspace}
\onehalfspacing

\usepackage[nottoc,notlof,notlot]{tocbibind} 
\renewcommand\bibname{References}

\graphicspath{ {./Thesis pictures/} }

\includeonly{Chapter3_content1}

\begin{document}
\title{
\huge{\textbf{Luminescent properties of semiconductor materials}}\\[1.2cm]
\Large{A thesis submitted to the University of Manchester \\ for the degree of Doctor     of Philosophy in the Facultly of Engineering and Physical Science} \\[1cm]
\Large{2015} \\
\Large{Rachel Southern-Holland} } 
\author{} 
\date{}
\maketitle

\newpage

\include{F:/Rachel_thesis/Chapters/Chapter3_content1}


\addcontentsline{toc}{chapter}{References}
\bibliography{PhD_Library}
\end{document}

and the tex file Chapter3_content1 looks like this

\chapter

this is my methods chapter

However when I compile the master document I only get the title page and not the content from the Chapter3_content1 file. Any ideas what I am doing wrong? Thanks a lot

  • If I were to guess: maybe because you have the full path in \include, but only the filename in \includeonly. – Torbjørn T. Mar 05 '15 at 12:59
  • You can't have a full path in the argument to \include; for security reasons, TeX will refuse to write the .aux file pertaining to such an \included file. – egreg Apr 04 '15 at 15:22

1 Answers1

1

The following works. Note that what you put in your \includeonly and \include should coincide. I've also trimmed the code to make it more like a MWE.

\documentclass{report}
\usepackage{filecontents}
\begin{filecontents}{Chapter3_content1}
\setcounter{chapter}{2}
\chapter{My third chapter}
The content of the third chapter is here.

Also, this is my methods chapter.
\end{filecontents}
\begin{filecontents}{Chapter4_content1}
\chapter{My fourth chapter}
\end{filecontents}
\includeonly{Chapter3_content1}
\begin{document}
\title{Luminescent properties of semiconductor materials}
\author{Rachel Southern-Holland}
\maketitle
\include{Chapter3_content1}
\include{Chapter4_content1}
\end{document}
Denis
  • 5,267
  • Hi, Sorry still not working just get chapter headings but not the content from chapter3_content1 file. – bonzo1984 Mar 05 '15 at 13:28
  • Also forgive my ignorance, what is a MWE? – bonzo1984 Mar 05 '15 at 13:28
  • MWE stands for Minimal Working Example, i.e., a piece of code that can be cut and pasted and compiled (Working) and that does not contain irrelevant things (Minimal). – Denis Mar 05 '15 at 13:33
  • In the example the files only contain the chapter headings and no text. If you want text, you have to add it! I have added some in my edit. – Denis Mar 05 '15 at 13:34
  • Ok I'm pretty confused now. My original tex file chapter3_content1 had text in it saying "this is my methods chapter" and that's gone now. What did I/you do? – bonzo1984 Mar 05 '15 at 13:48
  • Please have a look at the edit of the code. Note also that the idea here is not to reproduce the content of your chapter but to show how to get the \includeonly command to work as expected. – Denis Mar 05 '15 at 13:56
  • Denis has used filecontents package to put in a single document different files. If you have different files you should remove the filecontents environments. – Astrinus Mar 05 '15 at 14:48
  • @Astrinus Thanks for the clarifying comment! – Denis Mar 05 '15 at 15:00