≡ Menu

Including eps figures into LaTeX

I have a folder for my images that I include in my LaTeX documents called “img”. My graphics package is set by (it used to be slightly different — see bug report below):

\usepackage{graphicx}
  \graphicspath{{img/}}

Pro-tip: If you turn an image 90 degrees, it’s height and width are defined by how it started. So, if you have a plot that you want to be the same width as your text:

\includegraphics[height=\textwidth,angle=-90]{figure12}}

Pro-tip 2: I did not include an ending on figure12 — the graphicx package is smart enough to find the .eps, convert it, name the converted file figure12-eps-converted-to.pdf and then include it into your document. It leaves your original .eps there, and future compilations of the document just uses the pdf version, no need to reconvert.

Bug Report

I discovered some weird behavior (probably a bug) by the LaTeX package graphicx.

I was including the graphics package and setting the graphics directory by including the following in the preamble:

\usepackage{graphicx}
  \graphicspath{{./../img/}}

Meaning that the folder with all my images was up a directory and down in a folder called “img”. What’s weird is that it was not automatically converting the figures that were encapsulated postscript (*.eps) files into .pdfs that could be included. I tried all manner of changing the path (./../img/), not including the path and specifying it from the \includegraphics command… nothing worked until I moved the img folder into the same directory as the tex source.

My guess: graphicx does not handle the “..” in the path name correctly.