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?

closed as unclear what you're asking by egreg, user31729, Jesse, Martin Schröder, Masroor Jul 12 '14 at 10:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 <br/> 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 6:54
  • 1
    It's too bad this was closed, because I think it is clear - and tex.stackexchange.com/questions/66015/… has the answer, I believe. – kcrisman Aug 6 '14 at 10:39


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

and delete all helper files before running LaTeX again.

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