Graphics, Figures & Tablesfigure not appearing in pdf

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
amnakhan786
Posts: 1
Joined: Thu Jan 17, 2013 5:31 pm

figure not appearing in pdf

Post by amnakhan786 »

hi,
i am trying to include .eps figure in latex and hen convert it to pdf. I am a beginner and i read some info about adding figure but couldnt clearly get how to do it. I found this code online which is trying to include figure into latex but when i run this code this doesnot work(the figures doesnot appear) i dont understand where i should enter the name of figure, where i enter the path, or for this code i kept the figure in the same folder but no results.

Code: Select all

\documentclass[12pt]{article}
\usepackage{epsf}
\listfiles

\title{\bf How to include epsf files}
\author{Gianfranco Ciardo}

\setlength{\oddsidemargin}{-0.25in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0cm}
\setlength{\headsep}{0cm}
\setlength{\textheight}{10in}
\setlength{\textwidth}{7in}
\setlength{\topskip}{0cm}
\renewcommand{\baselinestretch}{1.1}
\renewcommand{\arraystretch}{1.2}
\renewcommand{\dbltopfraction}{0.9}
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.9}
\renewcommand{\dblfloatpagefraction}{0.99}
\renewcommand{\floatpagefraction}{0.99}
\renewcommand{\textfraction}{0.01}

% epsf figures (inline or centered)
\newcommand{\INLINEFIG}[1]{\epsfclipoff\epsffile{Figure.eps}}
\newcommand{\FIG}[1]{\begin{center}
  \mbox{\epsfclipoff\epsffile{Figure.eps}}
  \end{center}}
\def\epsfsize#1#2{1.0#1}	      % change 1.0 to any zoom factor you want

\pagestyle{empty}

\date{}

\begin{document}

\maketitle

\thispagestyle{empty}

First, you need to generate an ``eps'' (encapsulated postscript) file using
one of the tools available to you.
Then you can include it in a latex file.
To se how, examine the source file for this page.

This is an example of an inline figure, \INLINEFIG{Figure}, while
this is an example of the same figure centered in a space by itself:
\FIG{Figure}

You can scale the figure as you want:
for example, this is the same figure, just twice as large:
{\def\epsfsize#1#2{2.0#1}\FIG{Figure}}
or one fourth as large:
{\def\epsfsize#1#2{0.25#1}\FIG{Figure}}

In multipage documents, it is usually more appropriate to include pictures
only in the ``figure'' environment, as done in Fig.~\ref{FIG:myfig}.

\begin{figure}
\FIG{Figure.eps}
\caption{An example of floating figure.}
\label{FIG:myfig}
\end{figure}

\end{document}
url of the page where i found this code is: http://www.cs.ucr.edu/~ciardo/teaching/CS246/CS246.html

any help is appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

figure not appearing in pdf

Post by localghost »

amnakhan786 wrote:[…] url of the page where i found this code is: http://www.cs.ucr.edu/~ciardo/teaching/CS246/CS246.html […]
Forget this code completely, and fast. It is complete kludge. The epsf package is obsolete for a very long time. Have a look at the graphicx package. And page dimensions are set with geometry, not the way this code does it. One golden rule when using LaTeX:
If you don't know what code does, don't use it!
There are some more concerns which could be explained here. But just to forget it is much better.


Best regards and welcome to the board
Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

figure not appearing in pdf

Post by Stefan Kottwitz »

I agree with Thorsten. You had no luck in choosing the example code. It would take some time to explain why most of the code is not recommendable today with modern LaTeX.

I suggest, read a good LaTeX introduction or tutorial, before you work with a template which you cannot evaluate. This can help: LaTeX Resources for Beginners.

If you still want to start with a template, have a look at www.latextemplates.com.

If you have questions, let us know.

Stefan
LaTeX.org admin
Post Reply