TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to insert a figure into my LaTeX file using the following syntax:

  \includegraphics [width=3in]{fig1.png}
  \caption{Calculation of shortest path betweenness}
  \label{Fig.3:Shortest path betweenness}

It worked for me before but this time I'm getting the following error:

 LaTeX Error: \begin{figure} on input line xxx ended by \end{document}

Also, hovering over the red cross symbol indicating error in Eclipse, I see this message

 paragraph ended before Gin@iii was completed.

It's obvious that I have the \end{figure} to end my \begin{figure} so I don't understand how I still get that error.

Can someone please tell me what the problem is?

Edit: Add more details for debugging. The problem went away if I remove '[width=3in]'. Here is the detail error:

pdflatex> Runaway argument?
pdflatex> width=3in]{fig1.png} \caption {Caption} \label {Fig.1} 
pdflatex> ! Paragraph ended before \Gin@iii was complete.
pdflatex> <to be read again> 
pdflatex>                    \par 
pdflatex> l.40 
pdflatex> Underfull \vbox (badness 10000) has occurred while \output is active
pdflatex> (./document.bbl
pdflatex> Package natbib Warning: Empty `thebibliography' environment on input line 3.

Added sample code:

\paperwidth 8.5in
\paperheight 11in
\oddsidemargin 0in
\headsep 1.3cm 
\textwidth 7in 
\textheight 9.25in
\columnsep 0.4in
\footskip 0in 

\title{\fontfamily{phv}\selectfont{\huge{\bfseries{Title here}}}} \author{
{\fontfamily{ptm}\selectfont{\large{\bfseries{author name}}}}\thanks{contact
info }}


\section*{\fontfamily{phv}\selectfont{\normalsize{\bfseries{Section name}}}}


share|improve this question
Please add a minimal working example (MWE) that illustrates your problem. – Torbjørn T. Dec 8 '11 at 22:43
is there anyway I can attach a sample tex file to the question instead of pasting it? – chepukha Dec 8 '11 at 23:06
Not here. Some people post these files on other sites. However, this should not be necessary when provided a minimal working example. Also note that "Runaway argument" (or many of TeX's error messages) could potentially pertain to an entirely different part of your document that what is output to the console/.log. – Werner Dec 8 '11 at 23:07
No, but you should reduce your file to the minimum that still produces the error. Then it probably won't be too long to paste in. – Torbjørn T. Dec 8 '11 at 23:08
up vote 20 down vote accepted

The problem seems to be in the fact that you load


instead of


Only with the latter declaration you are able to use the syntax

share|improve this answer
Yes, that's exactly where the problem is. Thank you very much, egreg. – chepukha Dec 9 '11 at 3:34

Your Answer


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.