Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added \graphicspath support to \pgfdeclareimage #980

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/generic/pgf/text-en/pgfmanual-en-base-images.tex
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ \subsection{Declaring an Image}
will automatically tried. For PostScript, the extensions |.eps|, |.epsi|,
and |.ps| will be tried.

You may use |\graphicspath| to specify a list of directories in which to
search for graphics files.

The following options are possible:
%
\begin{itemize}
Expand Down
33 changes: 31 additions & 2 deletions tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
% If page= parameter is not empty, try that file first:
\ifx\pgf@imagepage\pgfutil@empty%
\else%
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}%
\expandafter\pgf@findimage\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}%
\fi%
\ifx\pgf@filename\pgfutil@empty%
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}%
\expandafter\pgf@findimage\pgfsys@imagesuffixlist:+{#3}%
\else%
\pgfkeys{/pgf/images/page=}% make page empty
\fi%
Expand Down Expand Up @@ -89,6 +89,35 @@
\pgf@findfile#2+{#3}%
\fi}}

% Similar to \pgf@findfile but for images.
% Additionally loops over directories in \Ginput@path.
\def\pgf@findimage#1:#2+#3{%
\ifx\Ginput@path\@undefined
\let\Ginput@path\@empty
\fi
\ifx\Ginput@path\@empty
% Graphics search path is empty.
% Pass the arguments to the base command as is.
\@pgf@findfile{#1}:{#2}+{#3}%
\else
\let\pgf@cur\@secondoftwo
\expandafter\@tfor\expandafter
\pgf@cur\expandafter:\expandafter=\Ginput@path\do{%
\def\pgf@curfilename{\pgf@cur/#3#1}%
\pgfutil@IfFileExists{\pgf@curfilename}%
{\xdef\pgf@filename{\pgf@curfilename}%
% Found the file. We're done searching.
\@break@tfor
}%
{\def\pgf@mightbeempty{#2}%
\ifx\pgf@mightbeempty\pgfutil@empty\else%
\pgf@findimage#2+{#3}%
\fi
}%
}%
\fi
}%

% #1: image name
% #2: file name
\def\pgf@declaredraftimage#1#2{%
Expand Down