My .tex file:

\hypersetup{pdftex,linktocpage=true,bookmarks=true,colorlinks=true,citecolor=blue,filecolor=black,linkcolor=blue,urlcolor=black,pdfauthor={Ayman Elmasry},pdftitle={Algorithmic Form Generation: A Thermal Building
Envelope Design Approach}}




I compile with pdflatex, and I get this error:

Runaway argument?
{\caption@CheckCommand \@makecaption {\long \def \@makecaption ##1##2\ETC.
! Paragraph ended before \@gobble was complete.
<to be read again> 
l.901         \unskip\kern-2\captionindent\par

When I comment out:


... I get an output PDF file with no problems.


2 Answers 2


The problem is a bug in arabtex which redefines \@gobble to be non-long.


One first gets \long macro:#1->, then macro:#1->. Macros must be \long to allow \par in their argument, hence the problem. One solution is to add {\makeatletter\long\gdef\@gobble#1{}} just after loading arabtex.


This restores the original definition of the LaTeX kernel function \@gobble.

  • Indeed that's the problem in my case! Thanks a lot!
    – iamaziz
    Sep 29, 2016 at 5:37

The error is not because of the caption package as the following MWE demonstrates.

\captionof{figure}{Just a test.}

It is always best to provide a minimal working example. I suggest you start removing lines from your code, or inserting \end{document} progressively until you identify the source of the error (possibly an unprotected command in caption text).


The arabtex package and utf8 both clash with the caption package. The arabtex package redefines quite a few items for R-L writing. Suggest removing them.

  • I've added an MWE in my question above. I hope it's correct that way. Jan 25, 2012 at 10:46
  • @AymanElmasry Your example is fine now, it demonstrates the error. Once you have a MWE is easy for you to trace the source. You can comment package by package out until you find the clash. The arabtex package gave me problems in the past with footnotes and I couldn't fix them.
    – yannisl
    Jan 25, 2012 at 10:56

You must log in to answer this question.

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