23

I am new to LaTeX and keep having this re-occurring problem. I create a table and notice a mistake (incorrectly specifying the number of columns or something) because the pdf won't compile (I am using 'pdfLaTeX'). I stop the compilation and fix the table. When I try to re-run the pdf I get the error message:

Runaway argument?
{\contentsline {subsection}{\numberline {6.3}General comments o 
! File ended while scanning use of \@writefile.
<inserted text> 
            \par 
l.47 \begin{document}

Once this happens no matter what I do the pdf won't run and the .synctex.gz file is 'busy'. I have to copy and paste all my (corrected) code into a new TeX works file and then it re-runs fine! I suspect it has something to do with the fact that LaTeX is still thinking about the erroneous table. How can I completely break the compilation process and stop this from happening?

5
  • 9
    Delete your temporary files and compile once more. Which Editor and TeX distribution do you use?
    – Mensch
    Commented Aug 6, 2012 at 3:43
  • 1
    also, please post the concerned lines from the .tex file. Commented Aug 6, 2012 at 4:49
  • 1
    You can delete (most) temporary files from within TeXworks: File --> Delete auxiliary files. Commented Aug 6, 2012 at 7:12
  • 5
    I made some tests with TeXworks on miktex 2.9. Imho it is not advisable to use the large button "stop prozess" (or however it is called in the english version). It simply kills the process and quite a lot files are not correctly closed. E.g. I don't get a log-file. When you get an error type "x" (the cursor should already be in the line at the bottom) and then hit "enter". This should close the files correctly. Commented Aug 6, 2012 at 8:26
  • I suggest forget to repair, just open another fire to do thing from the very begining! I use resizebox{7.5cm}{3cm} to control my table size in beamer. And this 7.5cm cause your problem....Sometimes, we should not foucs on the bs error message and do things from the very begining again.
    – Travis
    Commented Mar 10, 2020 at 15:13

4 Answers 4

23

You have 3 options:

  1. As Ulrike points out, you should stop the compilation by typing x into the command line at the very bottom.

  2. Delete .toc and .aux files after an incomplete compilation (There's a button File->Delete Temporary Files in TeXworks, as Torbjørn points out.

  3. Type q into the command line in TeXworks whenever this error at \begin{document} appears. The compilation will continue in a strange mode, but the next compilation should be ok.

6
  • 4
    In my experience, you can also simply press enter when receiving this error, and the compilation will proceed normally assuming you do not have any "real" errors. Commented Jun 30, 2015 at 1:39
  • what is this error caused by? Commented Aug 15, 2016 at 12:10
  • @yo' I have also a Runaway definition problem. I tried this solution but failed. My preamble is here paste.ubuntu.com/26318191
    – alhelal
    Commented Jan 4, 2018 at 9:04
  • And here is another good write-up of the same problem, with a more detailed explanation. Commented Sep 25, 2018 at 23:54
  • But how to fix it in a way that deleting aux files are not needed? I also have this now (needing to delete aux files always after some error, to be able to continue), but I did not have the problem earlier (never needed to delete aux files). Unfortunately I have no idea what exactly caused this.
    – Albert
    Commented Jan 12, 2020 at 15:23
2

If the problem with Overleaf, then see the below link.

Runaway argument?

This is usually caused by a corrupted/incomplete .toc or other intermediate file, and is frequently a sign that your project is running into its compile timeout limit. You can first try to clear the intermediate files by clicking on the "Recompile from scratch" option at the bottom of the error message window.

0
0

This was hard to find, but in my case, one of the references had the character % which wasn't escaped, which created all this problem.

All I did was find that reference from references.bib file, change % to \% and everything started working!

2
  • How does this address the given question please?
    – Mensch
    Commented Mar 9, 2022 at 16:34
  • Well, the error runaway argument at \begin{document} in my case, appeared because I skipped escaping one % in the references.bib file, as I have already mentioned in the answer. I could fix the error runaway argument at \begin{document} after I correctly escaped % by replacing it with \%. Please let me know why you think my answer doesn't address the question. I'd be happy to change/remove it. Thanks! Commented Mar 9, 2022 at 17:55
-1

In my experience, you should just stop the process and then delete the .aux file in the package. Then you compile the next time and it will be fine. Hope this answer can help you.

1
  • 1
    "Delete the .aux file in the package"? Not the package, surely... just the regular .aux.
    – Werner
    Commented Mar 17, 2016 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .