0

I'm new to LaTex and decided to start writing my thesis on it.

I've structured the basics of my main.tex file and created corresponding chapter tex files, adding them to the main file using /input. However, after I started writing chapter 3, it kept showing up as chapter four in the PDF compiled. Then I started writing chapter 4 in its corresponding file and now the PDF isn't even getting compiled anymore. I get the error message below:

error when compiling PDF

I'm not sure what might be wrong. Any ideas? Thanks for your help! Please let me know if I should provide any more info.

*edit: Thnaks for your help so far! I fixed the typos in chapter 4 and am now able to generate the PDF again, also fixed the fancyheadr issue. However, the issue with the chapters continues... Now chapter 3 is showing up as chapter 4 and chapter 4 is showing as chapter 6! I'm adding \chapter to the beginning of each chapter file, followed by the chapter title between {}. Also added this line to the top of each chapter file: %!TEX root=main.tex

Here's the code as requested (and thanks for any further help!):

   \documentclass[12pt, twoside]{report}
    \usepackage{natbib}
    \bibliography{references}
  \bibliographystyle{apa}
  \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm, bindingoffset=6mm]{geometry}
  \usepackage[utf8]{inputenc}
  \usepackage{graphicx}
  \graphicspath{ {Images/} }

  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \fancyhead{}
  \fancyhead[RO,LE]{thesis title}
  \fancyfoot{}
  \fancyfoot[LE,RO]{\thepage}
  \fancyfoot[LO,CE]{Chapter \thechapter}
  \fancyfoot[CO,RE]{} 
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.4pt}
  \setlength{\headheight}{14.5pt}

  \title{
      {title}\\
      {\large institute}\\
      {\includegraphics{}} %insert logo uni later
  }
  \author{deb}
  \date{Day Month Year} %insert date

  \begin{document}

  \input{Chapters/titlepage}

  \input{Chapters/abstract}  

  \chapter*{Dedication}

  \chapter*{Declaration}

  \chapter*{Acknowledgements}

  \tableofcontents

  \listoftables

  \listoffigures

  \chapter{Introduction}
  \input{Chapters/introduction}

  \chapter{Chapter Two Title}
  \input{Chapters/chapter02}

  \chapter{Brazilian context and the 2013 and 2014 protests in Fortaleza}
  \input{Chapters/chapter03}

  \chapter{Literature review on media practices}
  \input{Chapters/chapter04}

  \chapter{Chapter Five Title}
  \input{Chapters/chapter05}

  \chapter{Chapter Six Title}
  \input{Chapters/chapter06}

  \chapter{Chapter Seven Title}
  \input{Chapters/chapter07}

  \chapter{Conclusion}
  \input{Chapters/conclusion}

  \appendix
  \chapter{Appendix}
    \input{chapters/appendix}

    \end{document}

This is the code from both chapters (3 and 4):

    %!TEX root=main.tex

    \chapter{Brazilian context and the 2013 and 2014 protests in Fortaleza}

    \section{Why were people taking to the streets?} %this is an item for broader, structural contextualization


    \section{Who were the protesters in 2013 and 2014?} %this is an item for contextualization of the movements themselves and changes between both years through their lenses, which take into account the sociopolitical changes

    \section{The Brazilian media landscape}%ver também docs com citações para meu MA e outros artigos que tratam do assunto, mas não pegar os textos em si

    \section{Internet use and digital inclusion}

    \section{Alternative media: past and present}%ver também docs com citações para meu MA e outros artigos que tratam do assunto, mas não pegar os textos em si

    \section{Nigéria, Na Rua and the people around them}%ver o que posso aproveitar do exposé na descrição geral, principalmente dos dois coletivos

    \section{Interim summary}

chapter 4:

    %!TEX root=main.tex

    \chapter{Literature review on media practices}

    \section{Practice theory}
    *origins of the concept, canon literature

    \section{Practice Theory in the Context of Media Studies}
    \section{Media practices in protest movements}
    \section{Adaption of media practices}
    \subsection{Policitization of everyday media practices}
    \subsection{Activismization of professional journalistic practices}
    \subsection{Modification/creation of media practices as a reaction to changes in conjuncture}
    \section{Interim summary}

And this is what the Table of Contents looks like now:

table of contents

4
  • Welcome to TeX.SX! Please provide the minimal version of your code that produces this issue. I am pretty sure you have either a syntax error (wrong usage or a mere typo) -- without seeing code this is difficult to say. Anyway, there is a warning about headheight being to small, but that's the main issue here
    – user31729
    Commented Sep 6, 2016 at 17:13
  • The log indicates that chapter 4 starts within the file chapter03.tex. Note the opening and closing parentheses that indicate the start and end of that file.
    – Dan
    Commented Sep 6, 2016 at 21:37
  • 1
    You have \chapter{Brazilian...} two places ... Commented Sep 7, 2016 at 13:18
  • I agree with @TorbjørnT., you are writing the \chapter command two times for each chapter, so it gets executed (the counting too!) two times for each one.
    – Juri Robl
    Commented Sep 7, 2016 at 14:14

1 Answer 1

2

From the error message, I assume there is something like this in the code:

\section{Activismization of professional journalistic practices
\subsection{...}

Then the reason is the missing closing curly brace of the section title.


Also the \headheight warning of fancyhdr should be fixed:

  • If package geometry is used, then add option:

    \usepackage[
      ...,
      headheight=14.5pt,
    ]{geometry}
    
  • Manually (and with fixes of other vertical layout lengths, maybe):

    \setlength{\headheight}{14.5pt}
    

If this is not fixed, the layout will be inconsistent, the first pages will have a smaller \headheight, the following pages will have a larger header, which causes the text body to move down a little.


The chapter number problem should be analyzed further: Compare the information about chapters of the .log file with the output and the TeX sources. The you should be able to narrow down the problem and post some relevant code, if the problem cannot be solved.

7
  • 1
    Maybe a \chapter command in chapter03.tex ? (Or not.)
    – cfr
    Commented Sep 6, 2016 at 19:23
  • Thanks for all the help so far! I edited my question to add the code and some more information.
    – deb
    Commented Sep 7, 2016 at 6:38
  • 1
    @deb The code you posted isn't very helpful, as it is only a small fraction. Nobody knows what is inside the chapters. Looking at the screenshot, i guess you have \chapter{Wombat} in you main file and another \chapter{Wombat} in the chapter file.
    – Johannes_B
    Commented Sep 7, 2016 at 7:19
  • Hi Johannes, Thanks for the feedback! I haven't actually written much other than some notes in chapters 3 and 4, that's why other chapters still have template-y names in the main files. I've edited my question again to add the code from both chapters. Hope this is helpful!
    – deb
    Commented Sep 7, 2016 at 12:52
  • 1
    @SergeiPoulp -- actually, whether you put the \chapter line in the main file or in the chapter file can make a difference. \chapter causes a new (right-hand) page to start. if the chapter file is pulled in with \include, it too will start on a new page (that's one of the features of \include). i've found that it's useful to put the "real" \chapter command in the chapter file, and a copy in the main file, but commented out. this provides useful documentation without the extra page break. Commented Sep 7, 2016 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .