PDF 中的章节显示顺序不正确

PDF 中的章节显示顺序不正确

我刚开始学习 LaTex,并决定用它写我的论文。

我已经构建了 main.tex 文件的基本结构并创建了相应的章节 tex 文件,并使用 /input 将它们添加到主文件中。但是,在我开始编写第 3 章后,它在编译的 PDF 中一直显示为第 4 章。然后我开始在其相应的文件中编写第 4 章,现在 PDF 甚至不再编译。我收到以下错误消息:

编译 PDF 时出错

我不确定哪里出了问题。有什么想法吗?谢谢您的帮助!如果我需要提供更多信息,请告诉我。

*编辑: 感谢您迄今为止的帮助!我修复了第 4 章中的拼写错误,现在可以再次生成 PDF,还修复了 fancyheadr 问题。但是,章节问题仍然存在……现在第 3 章显示为第 4 章,第 4 章显示为第 6 章!我在每个章节文件的开头添加了 \chapter,然后在 {} 之间添加了章节标题。还在每个章节文件的顶部添加了此行:%!TEX root=main.tex

这是所要求的代码(感谢您的进一步帮助!):

   \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}

这是两章(第 3 章和第 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}

第四章:

    %!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}

现在目录的样子如下:

目录

答案1

根据错误信息,我假设代码中有这样的内容:

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

那么原因就是章节标题缺少右花括号。


还应修复\headheight以下警告:fancyhdr

  • 如果geometry使用包,则添加选项:

    \usepackage[
      ...,
      headheight=14.5pt,
    ]{geometry}
    
  • 手动(也许可以修复其他垂直布局长度):

    \setlength{\headheight}{14.5pt}
    

如果不解决这个问题,布局就会不一致,前几页的页眉会较小\headheight,后面几页的页眉会较大,这会导致正文稍微向下移动。


章节编号问题需要进一步分析:将文件章节信息.log与输出和 TeX 源进行比较。如果问题无法解决,您应该能够缩小问题范围并发布一些相关代码。

相关内容