What is the easiest way to switch from a document with color graphics to one with grayscale graphics?
I have various fig/
directories that contain my color graphics, and I already have corresponding fig-gray/
directories that contain the same graphics in grayscale.
Example directories:
path1/fig/foo.pdf
path2/fig/bar.pdf
path1/fig-gray/foo.pdf
path2/fig-gray/bar.pdf
I have includegraphics
commands in various included .tex files, e.g.
\includegraphics[width=5in]{path1/fig/foo.pdf}
.
Now what is the easiest way to tell LaTeX to switch to using the fig-gray/
directories instead? (I'd like to avoid having to preprocess my .tex files with search and replace.)
Best Answer
Use the
\graphicspath
macro from thegraphics/x
package to specify the directories with your images:Then you can remove them from the
\includegraphics
macros and only need to change the one line to:Alternative you could make the
-gray
part a macro, which avoid adding new paths twice:This also works directly with
\includegraphics
: