1

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

13
  • 2
    Welcome to TeX.SX! This error is usually due to fragile commands in section titles. An example of code is needed. – egreg Aug 21 '15 at 13:15
  • Welcome! It may mean you have an unmatched opening curly bracket. Or TeX thinks you do. Start by looking on line 16 of Thesis.tex but sometimes the line number won't be very accurate. Probably it is in your preamble, though. If you post code which we can use to reproduce the error, we can help you find it. – cfr Aug 21 '15 at 13:16
  • 1
    This is due to a corrupted aux file. Just remove the file Thesis.aux. (Most LaTeX text editors have this somewhere in the menus). – yo' Aug 21 '15 at 13:18
  • 1
    @yo' -- but since this seems to be a problem related to something that was in the .aux file, it might happen again (on a "second" run). egreg's pointer to section titles is a reasonable clue, and it is almost certainly in a section title recently added. – barbara beeton Aug 21 '15 at 13:22
  • 2
    @Manoj if you can make the smallest example you can that has the problem (probably just the section headings needed) then probably you can replace the words with abc and still show the same error. so no need to show any secrets, but basically if you comment out your section headings and remove the aux file then re-run latex, it should work, put the headings back one at a time until it breaks, and that will show the problem. – David Carlisle Aug 21 '15 at 13:38
5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.