![使用 \includegraphics 插入图像时,“段落在 \Gin@iii 完成之前结束”](https://linux22.com/image/243591/%E4%BD%BF%E7%94%A8%20%5Cincludegraphics%20%E6%8F%92%E5%85%A5%E5%9B%BE%E5%83%8F%E6%97%B6%EF%BC%8C%E2%80%9C%E6%AE%B5%E8%90%BD%E5%9C%A8%20%5CGin%40iii%20%E5%AE%8C%E6%88%90%E4%B9%8B%E5%89%8D%E7%BB%93%E6%9D%9F%E2%80%9D.png)
我正在尝试使用以下语法将图形插入到我的 LaTeX 文件中:
\begin{figure}
\centering
\includegraphics [width=3in]{fig1.png}
\caption{Calculation of shortest path betweenness}
\label{Fig.3:Shortest path betweenness}
\end{figure}
以前我这样做是可行的,但这次我收到以下错误:
LaTeX Error: \begin{figure} on input line xxx ended by \end{document}
另外,将鼠标悬停在 Eclipse 中表示错误的红十字符号上,我看到了此消息
paragraph ended before Gin@iii was completed.
很明显,我必须\end{figure}
结束我的\begin{figure}
,所以我不明白为什么我仍然会收到那个错误。
有人能告诉我问题出在哪里吗?
编辑:添加更多调试细节。如果我删除“[width=3in]”,问题就消失了。以下是详细错误:
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.
添加了示例代码:
\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}
答案1
问题似乎在于你加载
\usepackage{graphics}
代替
\usepackage{graphicx}
只有使用后一种声明,您才可以使用语法
\includegraphics[width=3in]{fig1.png}