Trouble with displaying figures in LaTeX

  • LaTeX
  • Thread starter JoAuSc
  • Start date
  • Tags
    Latex
In summary, 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. 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?
  • #1
JoAuSc
198
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:
\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?
 
Physics news on Phys.org
  • #2
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.)
 
  • #3
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.
 
  • #4
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:
  • #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.
 
  • #6
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).
 
  • #7
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).
 

FAQ: Trouble with displaying figures in LaTeX

What is the most common reason for figures not displaying properly in LaTeX?

The most common reason for figures not displaying properly in LaTeX is due to incorrect placement or formatting of the figure code. This can include missing or incorrect commands, incorrect file paths, or using incompatible image file formats.

How can I troubleshoot figure display issues in LaTeX?

To troubleshoot figure display issues in LaTeX, it is important to check for any errors or warnings in the log file. Additionally, checking the figure code for any formatting or placement errors and ensuring that the image files are in the correct location and format can help resolve display issues.

Why is my figure appearing in a different location than specified in the code?

This can occur if the figure code is placed within a float environment and the placement options (such as [h], [t], [b], etc.) are not specified correctly. It can also happen if there is not enough space on the current page for the figure, causing it to be pushed to the next page.

How can I resize or adjust the position of my figures in LaTeX?

To resize or adjust the position of figures in LaTeX, you can use the \includegraphics command with optional arguments such as scale, width, or height. You can also use the \caption and \label commands to add a caption and label to your figure, which can then be referenced and positioned using the \ref and \pageref commands.

Are there any packages or tools that can help with figure display in LaTeX?

Yes, there are several packages and tools that can assist with figure display in LaTeX, such as graphicx, subfig, and floatrow. These packages provide additional options for figure placement, resizing, and captioning. Additionally, online tools such as ShareLaTeX and Overleaf offer a user-friendly interface for inserting and managing figures in LaTeX documents.

Similar threads

Replies
4
Views
2K
Replies
3
Views
452
Replies
1
Views
5K
Replies
8
Views
11K
Replies
5
Views
2K
Replies
2
Views
3K
Replies
4
Views
2K
Back
Top