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: https://tex.stackexchange.com/questions/169029/xdvipdfmx-out-of-memory.


1 Answer 1


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.

Not the answer you're looking for? Browse other questions tagged .