[Tex/LaTex] What does this error mean

errors

This is my first attempt in using Tex and I am already drafting my Thesis in this, but so far so good. However, I have lately encountered this error, and I cannot figure out what this means…
help please…enter image description here

%LINE 16
\begin{document}
\frontmatter      % Begin Roman style (i, ii, iii, iv...) page numbering

% Set up the Title Page







_____________________________
% Chapter 1

\chapter{Introduction} % Write in your own chapter title
\label{Chapter1}
\lhead{Chapter 1. \emph{Introduction}} % Write in your own chapter title to set the page header
\section{Background}

\section{Motivation}

\section{Research Aim and Objectives}

\section{Research Approach}

\section{Thesis Structure}

enter image description here

Best Answer

I think yo' is right with the comment, that the .aux file is truncated:

\documentclass{article}
\begin{document}
\tableofcontents
\section{Hello World}
\end{document}

After pdflatex test.tex the .aux file is:

\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}Hello World}{1}}

Then the .aux file is edited in an editor to truncate it to:

\relax
\@writefile{toc}{\contentsline {s

Running again:

pdflatex -file-line-error test.tex

gives the error in the same format as in the question:

) (./test.aux)
Runaway argument?
{\contentsline {s
./test.tex:2: File ended while scanning use of \@writefile.
<inserted text>
                \par
l.2 \begin{document}

?

The \@writefile command starts on line 2 in file test.aux, but the error is detected after the file end, thus the file name is shown as test.tex.

Back to the question, the error occurs during the first read of the .aux file. The .aux file is truncated at line 16.

Suspicion: The file size of the .aux file is just a sector with 512 bytes. Thus the write cache did not get flushed at the probably abnormal end of the previous LaTeX run.

Deleting the .aux file and running LaTeX again should fix the issue, when the run is not aborted due to a fatal error.

Related Question