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.

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

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

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>       
pdflatex> 
pdflatex> Underfull \vbox (badness 10000) has occurred while \output is active
pdflatex> (./document.bbl
pdflatex> 
pdflatex> Package natbib Warning: Empty `thebibliography' environment on input line 3.

Added sample code:

\documentclass[10pt,psfig,letterpaper,twocolumn]{article}
\usepackage{geometry}
\usepackage{graphics}
\usepackage{setspace}
\usepackage{natbib}
\usepackage{verbatim}
\usepackage[scaled=0.9]{helvet}
\singlespacing
\paperwidth 8.5in
\paperheight 11in
\oddsidemargin 0in
\headsep 1.3cm 
\geometry{left=0.75in,top=0.75in,right=0.75in,bottom=1in}
\textwidth 7in 
\textheight 9.25in
\columnsep 0.4in
\footskip 0in 
\renewcommand{\bibname}{REFERENCE}
\pagestyle{empty} 
\begin{document}
\bibliographystyle{acm} 

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

\maketitle
\thispagestyle{empty}

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

\begin{figure}
\centering
\includegraphics[width=3in]{fig1.png}
\caption{Caption}
\label{Fig.1}
\end{figure}

\pagebreak[4]
\vspace*{5.52in}
\bibliography{ref}
\end{document}
share|improve this question
1  
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
1  
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
add comment

1 Answer

up vote 11 down vote accepted

The problem seems to be in the fact that you load

\usepackage{graphics}

instead of

\usepackage{graphicx}

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

\includegraphics[width=3in]{fig1.png}
share|improve this answer
    
Yes, that's exactly where the problem is. Thank you very much, egreg. –  chepukha Dec 9 '11 at 3:34
add comment

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.