%%
%% This is file `figlatex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% figlatex.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from figlatex.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file figlatex.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% File: figlatex.dtx Copyright (C) 2002--2005 V. Danjean, A. Legrand
%%    Vincent.Danjean@ens-lyon.org
%%    Arnaud.Legrand@ens-lyon.org
%%
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License
%% as published by the Free Software Foundation; either version 2
%% of the License, or (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
%%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{figlatex}%
[2021/10/26 v2.4.3 No changes in figlatex]
\newif\ifFL@debug
\DeclareOption{debug}{%
  \global\FL@debugtrue%
}
{
  \def\debug{%
    \ExecuteOptions{debug}%
  }
  \InputIfFileExists{figlatex.cfg}{%
    \typeout{***************************************^^J%
             * Local config file figlatex.cfg used *^^J%
             ***************************************}
  }{%
    \typeout{Found no configuration file for figlatex}
  }
}
\ProcessOptions
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
\RequirePackage{graphicx}
\RequirePackage{xstring}
\RequirePackage{color}
\RequirePackage{epstopdf}
\def\FL@dmessage#1{%
  \ifFL@debug%
    \message{#1}%
  \fi%
}
\def\Ginclude@rawtex#1{%
  \FL@dmessage{<#1>}%
  \bgroup%
  \def\@tempa{!}%
  \ifx\Gin@scaley\@tempa%
    \let\Gin@scaley\Gin@scalex%
  \else%
    \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi%
  \fi%
  \hbox{%
    \Gscale@box{\Gin@scalex}[\Gin@scaley]{%
      \def\Gin@scalex{1}%
      \let\Gin@scaley\Gin@exclamation% needed for pdflatex
      \FL@dmessage{<loading rawtex #1>}%
      \input{#1}}}%
  \egroup}
\def\Ginclude@figtex#1{%
  \message{<#1>}%
  \bgroup%
  \xdef\FL@filename{#1}%
  \filename@parse{\FL@filename}%
  \xdef\FL@filename{\filename@area\filename@base.\FL@figext}%
  \FL@dmessage{<****loading fig \FL@filename>}%
  \FL@includerawtexgraphics[]{\FL@filename}%
  \egroup}
\newcommand{\Gread@figtex}[1]{%
  %\typeout{Oh, file exists #1}%
  \Gread@rawtex{#1}%
}
\def\Ginclude@svgtex#1{%
  \message{<#1>}%
  \bgroup%
  \xdef\FL@filename{#1}%
  \filename@parse{\FL@filename}%
  \xdef\FL@filename{\filename@area\filename@base.\FL@svgext}%
  \FL@dmessage{<****loading svg \FL@filename>}%
  \FL@includerawtexgraphics[]{\FL@filename}%
  \egroup}
\newcommand{\Gread@svgtex}[1]{%
  %\typeout{Oh, file exists #1}%
  \Gread@rawtex{#1}%
}
\ifpdf
  \def\FL@figext{pdftex_t}%
  \def\FL@svgext{pdftex_t}%
  \let\Gread@rawtex\Gread@pdf%
  \DeclareGraphicsRule{.pdftex}{pdf}{*}{}%
  \DeclareGraphicsRule{.pdftex_t}{rawtex}{.pdftex}{}%
  \DeclareGraphicsRule{.fig}{figtex}{.pdftex}{}%
  \DeclareGraphicsRule{.svg}{svgtex}{.pdftex}{}%
\else
  \def\FL@figext{pstex_t}%
  \def\FL@svgext{pstex_t}%
  \let\Gread@rawtex\Gread@eps%
  \DeclareGraphicsRule{.pstex}{eps}{*}{}%
  \DeclareGraphicsRule{.pstex_t}{rawtex}{.pstex}{}%
  \DeclareGraphicsRule{.fig}{figtex}{.pstex}{}%
  \DeclareGraphicsRule{.svg}{svgtex}{.pstex}{}%
\fi
\newcommand{\FL@includerawtexgraphics}[2][]{%
  \includegraphics[#1]{#2}%
}
\def\FL@exclamation{!}%
\let\FL@subfig@name\FL@exclamation%
\define@key{Gin}{subfig}{%
  \typeout{using subfig #1}%
  \def\FL@subfig@name{#1}%
}
\def\FL@sepdefault{_}%
\def\FL@subfig@check#1{%
}
\def\FL@Gin@getbase#1{%
  \typeout{In getbase #1 with \FL@subfig@name / \FL@exclamation}%
  \ifx\FL@subfig@name\FL@exclamation%
  \else%
  \typeout{getbase lets go (\filename@area)(\filename@base)(#1)}%
  \IfStrEq*{#1}{.fig}{%
    % If we're including a subfig
    \IfFileExists{\filename@area\filename@base#1}{%
      % If the original .fig file exists, just change the name so that
      % it comprises the full path (file has been looked into
      % texgraphics, etc.)
      % Warning: the found filename is quoted :-(
      \StrBetween[1,2]{\@filef@und}{"}{"}[\FL@filename@unquoted]
      \filename@parse{\FL@filename@unquoted}%
      % Check if the subfig file exists
      \FL@subfig@check{\filename@area\filename@base.subfig}%
    }{%
      % Else, write a warning (LaTeX will warn as well but it doesn't
      % hurt)
      \PackageWarning{figlatex}{No file
        '\filename@area\filename@base#1'}%
    }
    % Add the subfig suffix to the fig name.
    \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}%
  }{%
  }%
  \IfStrEq*{#1}{.svg}{%
    % If we're including a subfig
    \IfFileExists{\filename@area\filename@base#1}{%
      % If the original .svg file exists, just change the name so that
      % it comprises the full path (file has been looked into
      % texgraphics, etc.)
      % Warning: the found filename is quoted :-(
      \StrBetween[1,2]{\@filef@und}{"}{"}[\FL@filename@unquoted]
      \filename@parse{\FL@filename@unquoted}%
      % Check if the subfig file exists
      \FL@subfig@check{\filename@area\filename@base.subfig}%
    }{%
      % Else, write a warning (LaTeX will warn as well but it doesn't
      % hurt)
      \PackageWarning{figlatex}{No file
        '\filename@area\filename@base#1'}%
    }
    % Add the subfig suffix to the svg name.
    \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}%
  }{%
  }%
  \fi%
  \FL@orig@Gin@getbase{#1}%
}
\let\FL@orig@Gin@getbase\Gin@getbase
\let\Gin@getbase\FL@Gin@getbase


\endinput
%%
%% End of file `figlatex.sty'.
