Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My .tex file:

\documentclass[a4paper,twoside,portrait,12pt,openright,final,pdflatex]{report}
\usepackage[bindingoffset=8mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{arabtex}
\usepackage{utf8}
\usepackage{graphicx}
\usepackage{float} 
\usepackage{caption}
\captionsetup{font=small,labelfont=bf}
\setcounter{secnumdepth}{3}
\usepackage{fixltx2e} 
\usepackage{paralist} 
\usepackage{hyperref}
\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}}
\usepackage[all]{hypcap}
\usepackage{lipsum}

\begin{document}

\lipsum[1-20]

\end{document}

I compile with pdflatex, and I get this error:

(/usr/local/texlive/2011/texmf-dist/tex/latex/caption/caption.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/caption/caption3.sty
Runaway argument?
{\caption@CheckCommand \@makecaption {\long \def \@makecaption ##1##2\ETC.
! Paragraph ended before \@gobble was complete.
<to be read again> 
                   \par 
l.901         \unskip\kern-2\captionindent\par

When I comment out:

%\usepackage{caption}
%\captionsetup{font=small,labelfont=bf}

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

share|improve this question
1  
Please post a full minimal example: the snippet you give is not enough to work from. –  Joseph Wright Jan 25 '12 at 10:03
    
@JosephWright: as in the full preamble an the whole log? –  Ayman Elmasry Jan 25 '12 at 10:10
    
    
@JosephWright: OK, this my first 'minimal example', I hope it's right that way. –  Ayman Elmasry Jan 25 '12 at 10:44

3 Answers 3

up vote 9 down vote accepted

The MWE can be cut down to

\documentclass{article}
\usepackage{arabtex}
\usepackage{caption}
\usepackage{lipsum}

\begin{document}

\lipsum[1-20]

\end{document}

while the problem goes away with

\documentclass{article}
\usepackage{caption}
\usepackage{arabtex}
\usepackage{lipsum}

\begin{document}

\lipsum[1-20]

\end{document}

loading caption before arabtex.

share|improve this answer

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

\documentclass{article}
\usepackage{caption}
\captionsetup{font=small,labelfont=bf}
\begin{document}
\captionof{figure}{Just a test.}
\end{document}

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).

Edit

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.

share|improve this answer
    
I've added an MWE in my question above. I hope it's correct that way. –  Ayman Elmasry Jan 25 '12 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. –  Yiannis Lazarides Jan 25 '12 at 10:56

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

\documentclass{article}
{\makeatletter\typeout{\meaning\@gobble}}
\usepackage{arabtex}
{\makeatletter\typeout{\meaning\@gobble}}
\stop

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.

\usepackage{arabtex}
{\makeatletter\long\gdef\@gobble#1{}}

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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