LaTeX forum ⇒ Graphics, Figures & TablesProblem with the package graphicx

Information and discussion about graphics, figures & tables in LaTeX documents.
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Problem with the package graphicx

Postby NELLLY » Fri Feb 15, 2013 1:17 pm

Hi
I have to follow the style of a given scientific journal's paper.
Graphics should be inserted using this command
  1. \begin{figure}[htp]
  2. \usepackage{graphics}
  3. \begin{center}
  4. \includegraphics[angle=0,width=7cm]{figurename}
  5. \caption{....} \label{fig1}
  6. \end{center}
  7. \end{figure}

when I typset a text sample I didn't get the graphic. In my past works, when I insert a graphic I indicate its path in the line
  1. \begin{figure}[H]
  2. \center
  3. \includegraphics [width=0.95\textwidth, angle=-90]
  4. {C:/MESIMAGES/figurename}
  5. \caption{...}
  6. \label{f2}
  7. \end{figure}

While in the first code, there is no path of the figure's placement. Where should I save my figure? Note: I use Winedit

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9595
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Feb 15, 2013 2:21 pm

The editor doesn't matter.

In the first code snippet, \usepackage{graphics} is wrong. It should be in the preamble, and it should be graphicx instead. Furthermore, the center environment causes additional vertical spacing, \centering is better. \center is bad, it's a bad abbreviation of the center environment.

[H] in the second code snippet is bad for automatic page breaking.

Regarding the path to the file, you can specify one, or omit it if the image is in the same directory as the main document. (Or graphicspath is used or an environment variable)

Stefan
LaTeX.org admin

NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Postby NELLLY » Fri Feb 15, 2013 4:06 pm

Hi
I made a mistake when I posted the message. Instead I used \usepackage{graphicx} before \begin{document}.
I saved the image in the same folder containing the latex file. When I compile the file the following error appears
  1. LaTeX Error: File'figurename' not found

I tried to use the path that I used for my previous figures and also I got the same problems. Notice that I saved some of my figures in the pdf format and some other with bmp extension. Previously, I didn't have such errors using the same instructions. Also when I typset my old files tHE same errors appears for all my figures.I didn't know what happened.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9595
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Feb 15, 2013 6:43 pm

NELLLY wrote:Notice that I saved some of my figures in the pdf format and some other with bmp extension.


The bmp format is not supported by pdfLaTeX. I suggest to convert it to PNG format.

Stefan
LaTeX.org admin

NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Postby NELLLY » Fri Feb 15, 2013 8:38 pm

Hi Stefan
I saved the graphic with pdf extension and it works that time. However I get the following error
  1. \begin{figure}[htp]
  2. \includegraphics [width=0.95\textwidth, angle=-90]
  3. {figurename}
  4. \caption{...}\label{f1}
  5. \end{figure}

  1. Cannot determine the size of graphic in figurename

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Feb 16, 2013 11:51 am

NELLLY wrote:[…] I saved the graphic with pdf extension and it works that time. […]

What does that exactly mean? did you really convert the image or did you only change the suffix (.bmp→.pdf)? Which program did you use? The error indicates that the image file has not really been converted.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 1 guest