I have tried two approaches to including graphics from multiple directories, one using graphicspath and another using macros.
The graphics path approach is:
\documentclass{beamer}
\usepackage{graphicx}
\graphicspath{{/path\_1/figs/}{/path\_2/figs}}
\begin{document}
\begin{frame}
\includegraphics[options]{fig.png} % where fig.png is in one of the two directories
\end{frame}
\end{document}
The error from the graphicspath approach is as follows:
[1{/home/user/.texlive2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
LaTeX Warning: File `fig.png' not found on input line [x].
! Package pdftex.def Error: File `fig.png' not found.
The macro approach consists in defining "variables" (macros/commands) holding the paths to the images and then building the full path using the variable (directory) and the filename (string literal). I have tried using def and newcommand and have also tried using expandafter to ensure that the argument to includegraphics is first expanded (1, 2).
\documentclass{beamer}
\usepackage{graphicx}
\def\mydir{/path\_1/figs/} % defining via \def
%\newcommand{\mydir}{/path\_1/figs/} % also tried defining via \newcommand
\begin{document}
\begin{frame}
% all the following fail
\includegraphics[options]{\mydir{}fig.png}% 1
\expandafter\includegraphics[options]{\mydir{}fig.png}% 2
\expandafter\includegraphics\expandafter[options]{\mydir{}fig.png}% 3
\expandafter{\includegraphics[options]}{\mydir{}fig.png}% 4
\end{frame}
\end{document}
The error from the macro approach varies; errors below are numbered according to the comments in each of the lines above.
error for #1-3:
[1{/home/user/.texlive2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
! Missing number, treated as zero.
N
l.[x] \end{frame}
error for #4:
[1{/home/user/.texlive2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
! Argument of \beamer@readarg has an extra }.
<inserted text>
\par
l.[x] \end{frame}
I would be interested in seeing how to get both approaches to work, as well as suggestions for alternative approaches. One advantage of using "variables" (macros) is that identically named files can be present in the various image directories without causing ambiguity since the desired directory is explicitly specified.
_? – samcarter_is_at_topanswers.xyz Jul 27 '18 at 19:11\usepackage{graphicx}with beamer – samcarter_is_at_topanswers.xyz Jul 27 '18 at 19:12graphicxpackage for beamer documents. – user001 Jul 27 '18 at 19:18\graphicspath{{/path_1/figs/}{/path_2/figs}}works fine for me with pdflatex from TL18 – samcarter_is_at_topanswers.xyz Jul 27 '18 at 19:21pdflatex(pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian); kpathsea version 6.2.2) and mytexliveversion is 2016.20170123-5 (https://packages.debian.org/stretch/texlive). – user001 Jul 27 '18 at 19:27graphicspath, but I must not have, since doing so allows the image to load; your comment therefore solves the graphicspath problem. – user001 Jul 27 '18 at 19:32