%!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 25 0 75 30 newpath 25 0 moveto 75 0 lineto 40 30 lineto closepath stroke showpage
\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
This is a postscript figure
\includegraphics{triangle.eps}
\end{document}
pdf triangledrawingresults in the error message:
Unknown graphics extension: .eps.
Solution
ps2pdf triangle.eps triangle.pdf
\documentclass[12pt]{article}
\ifx\pdftexversion\undefined % in the case of `latex' command
\usepackage[dvips]{graphics}
\usepackage[dvips]{color}
\else % in the case of `pdflatex' command
\usepackage[pdftex]{graphics}
\usepackage[pdftex]{color}
\fi
\begin{document}
This is a postscript figure
\ifx\pdftexversion\undefined
% no action
% standard latex processing requires no position adjustment
\else
\vspace*{-750pt} % pdflatex requires a vertical adjustment of graphics
% - unfortunately different in different cases
\fi
\includegraphics{triangle} % Do not specify extension!
% The program will automatically choose whether to use
% `triangle.eps' or `triangle.pdf'
\end{document}
Do we need this at all?
Maybe not. After all, a dvi can be converted to a pdf using the commands dvips, ps2pdf (or similar, depending on the system) However, one situation where pdflatexed file seems to work better (in my experience) is a slide presentation.
Author: Dr. Sergey Sadov (Dept.of Mathematics and Statistics, Memorial University of Newfoundland), serge dot sadov at google dot com