TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Is there a way to define a new command so that existing




for any x and fig_name? This is for automatic conversion of eps to pdf because eps may cause out of memeory issues with xdvipdfmx: xdvipdfmx out of memory.

share|improve this question

marked as duplicate by Werner, Claudio Fiandrino, Thorsten, Jesse, ChrisS Apr 3 '14 at 7:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

If all your usages exclude the use of a file extension, then you can simply do


which would transform




The use of letltxmacro is required in order to cope with the optional argument of \includegraphics. See When to use \LetLtxMacro?

Alternatively, and perhaps much easier, you can use


See File format preference with graphicx.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.