1

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

\includegraphics[scale=x]{fig_name}

becomes

\includegraphics[scale=x]{fig_name.eps}

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.

0

1 Answer 1

2

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

\usepackage{graphicx,letltxmacro}
\LetLtxMacro{\oldincludegraphics}{\includegraphics}
\renewcommand{\includegraphics}[2][]{\oldincludegraphics[#1]{#2.eps}}

which would transform

\includegraphics[*]{**}

to

\includegraphics[*]{**.eps}

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

\DeclareGraphicsExtensions{.eps}

See File format preference with graphicx.

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