summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/latex-make/figlatex.sty
blob: 1b41ef9d3e4850732e70a379a271b7bebf65c8a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
%%
%% 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/01/03 v2.4.2 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'.