0

Suppose a graphic file myimage contained in a subdirectory images of the current directory.

With the following MCE:

\documentclass{article}
\usepackage{graphicx}

\newcommand{\ImagesDirectory}{images}

\graphicspath{{\ImagesDirectory/}}

\begin{document} \includegraphics{myimage} \end{document}

the graphic file myimage is found.

But, with the following MCE where \newcommand{\ImagesDirectory}{...} is replaced by \DeclareDocumentCommand{\ImagesDirectory}{}{...}:

\documentclass{article}
\usepackage{graphicx}

\DeclareDocumentCommand{\ImagesDirectory}{}{images}

\graphicspath{{\ImagesDirectory/}}

\begin{document} \includegraphics{myimage} \end{document}

the graphic file myimage is not found.

Why and is there a workaround still relying on \DeclareDocumentCommand or friends (and not \newcommand and friends)?

Denis Bitouzé
  • 9,652
  • 4
  • 27
  • 85

0 Answers0