17

My problem is that if I try to recompile a text after correction of some mistake, e.g. missing "}", the I get a message

Runaway argument? {\contentsline {figure}{\numberline {\relax 3.9}{\ignorespaces ! File ended while scanning use of \@writefile.

            \par 

l.128 \begin{document}

Then I delete the *.aux file and other auxiliary files and so I can recompile without any problem. Howewer if again I get a mistake, compile the text,get an error message, stop compiling, fix an error in the text and try to recompile, again I will get the same "File ended while scanning use of \@writefile." and again the only one way is to delete the auxiliary files. Any suggestions how to fix the problem?

redspirit
  • 171
  • 1
  • 1
  • 3
  • 1
    Welcome to TeX.SX! Can you show the text in the caption of figure 3.9? This seems a problem of a fragile command. – egreg Jun 11 '14 at 22:45
  • @egreg Here is the info about Figure3.9, however I had this problem before I made this figure: \begin{figure}[h]
    \centering \includegraphics[width=0.8\linewidth]{Off-Spec_Kinematics} \caption{ Scheme of GI off-specular scattering kinematics. Modified from \cite{Zabel2007handbook} } \label{Off-Spec_Kinematics} \end{figure}
    – redspirit Jun 11 '14 at 23:14
  • by the way I don't get a point how to put a linebreale in comment. "End a line with two spaces to add a
    linebreak:" what does it means?
    – redspirit Jun 11 '14 at 23:23
  • The \cite command should not be a cause for the error; however this depends on what packages you load, because usually \cite will not be a problem in \caption. A minimal working example (MWE) is needed. – egreg Jun 12 '14 at 06:54
  • 6
    It's too bad this was closed, because I think it is clear - and http://tex.stackexchange.com/questions/66015/errors-in-tables-then-runaway-argument-at-begindocument has the answer, I believe. – kcrisman Aug 06 '14 at 10:39

1 Answers1

4

Use

\caption{Scheme of GI off-specular scattering kinematics. 
         Modified from~\protect\cite{Zabel2007handbook}}%%%<---
\label{Off-Spec_Kinematics}

and delete all helper files before running LaTeX again.