Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trouble with displaying figures in LaTeX

  1. Nov 28, 2007 #1
    I'm using TeXnic center and I'm trying to figure out how to display figures in LaTex, but all I'm getting is a blank space. (No errors, though. Also, I haven't had problems with ordinary LaTeX stuff.)

    Code (Text):
    \documentclass{article}

    \usepackage{amsfonts}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage[dvips]{graphicx}

    \begin{document}

    %random text
    fgf

    \begin{figure}
        \centering
            \includegraphics{D:/chick.ps}
        \label{fig:chick}
    \end{figure}

    \end{document}
    I originally tried this with an .eps file I generated from a MATLAB plot, and got a blank space, so I tried "chick.ps" which is an image file of a yellow chick I found on some help page, but still no result. Does anyone know why my image isn't displaying?
     
  2. jcsd
  3. Nov 29, 2007 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    is the path correct?
    Put the graphics file the same directory as the .tex file, then give the filename without the path. (I don't think you can use a .ps file.)
     
  4. Nov 29, 2007 #3

    cristo

    User Avatar
    Staff Emeritus
    Science Advisor

    I don't think you can use .ps files either. I know that you can use .eps files, though. Like rob said, make sure you put it in the in same folder as you .tex file.
     
  5. Nov 29, 2007 #4

    Kurdt

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    You can also use images saved in PDF format. Like the others have said, make sure that you save the file in the same folder as your tex document.

    If you're using the protext package that comes with Miktex then there are several pdf latex guides in the protext/doc folder.
     
    Last edited: Nov 29, 2007
  6. Dec 9, 2007 #5
    I don't think the path is the problem here. Thanks for the info on not using .ps. I'll look into the pdf latex guides (yes, I am using a protext package).

    I haven't completely solved the problem, but I can say that it works when I output a DVI file, but I get a blank space when I output to PDF (which is what I was doing before) or to PS.
     
  7. Dec 9, 2007 #6

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    IIRC, there is a difference between producing pdf files:
    pdflatex vs latex+dvipdf vs latex+dvips+(gs conversion to pdf)
    and what kind of images can be used into the graphics statement.
    I exclusively use latex+dvips+(gs conversion to pdf).
     
  8. Dec 9, 2007 #7

    cristo

    User Avatar
    Staff Emeritus
    Science Advisor

    That's true actually; I don't think pdflatex can cope with .eps files in the argument for graphicx. You may have to convert this into a .pdf file, or .jpg (or many other types, I imagine).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Trouble with displaying figures in LaTeX
  1. Figures in LaTex (Replies: 3)

  2. Latex figures (Replies: 6)

Loading...