summaryrefslogtreecommitdiff
path: root/support/autolatex/sty/autolatex.sty
blob: f5a8b423517dd3109fd28b1a42d201f4ff7f01aa (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
% autolatex - autolatex.sty
% Copyright (C) 1998-2022  Stephane Galland <galland@arakhne.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; see the file COPYING.  If not, write to
% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
% Creation date: 2006-08-23
% Modifications:
%

\global\edef\autolatex@package@ver{2022/02/10}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{autolatex}[\autolatex@package@ver]

\RequirePackage{graphicx}
\RequirePackage{xkeyval}
\RequirePackage{tikz}

%----------------------------------------
% IMAGES INCLUDING TEX EXPRESSIONS
%----------------------------------------

\define@key[autolatex]{withtex}{width}{%
	\gdef\@autolatex@wtfig@width{#1}%
}
\define@key[autolatex]{withtex}{height}{%
	\gdef\@autolatex@wtfig@height{#1}%
}

%-----
%\DeclareGraphicsExtensionsWtex{coma separated extensions}
\providecommand{\DeclareGraphicsExtensionsWtex}[1]{%
	\xdef\@@wtfig@extensions{\zap@space#1 \@empty}%
}
\DeclareGraphicsExtensionsWtex{.pdftex_t,.pstex_t,.pdf_tex,.ps_tex}

\providecommand{\@autolatex@wtfig@searchinpath}[1]{%
	\IfFileExists{#1}{%
		\protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{#1}}}%
	}{%
		\@for\@autolatex@wtfig@pathtmp:=\Ginput@path\do{%
			\ifx\@autolatex@wtfig@tmp\relax%
				\IfFileExists{\@autolatex@wtfig@pathtmp#1}{%
					\protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{\@autolatex@wtfig@pathtmp#1}}}%
				}{}%
			\fi%
		}%
	}%
}

%-----
%\includefigurewtex[width=xx,height=yy]{filename}
\providecommand{\includefigurewtex}[2][width=\linewidth]{%
	\begingroup%
	\gdef\@autolatex@wtfig@width{!}%
	\gdef\@autolatex@wtfig@height{!}%
	\setkeys[autolatex]{withtex}{#1}%
	%
	\global\let\@autolatex@wtfig@tmp\relax%
	\global\let\@autolatex@wtfig@ext\relax%
	\global\let\@autolatex@wtfig@path\relax%
	\filename@parse{#2}%
	\ifx\filename@ext\relax%
		\@for\@autolatex@wtfig@exttmp:=\@@wtfig@extensions\do{%
			\expandafter\@autolatex@wtfig@searchinpath{#2\@autolatex@wtfig@exttmp}%
		}%
	\else%
		\expandafter\@autolatex@wtfig@searchinpath{#2}%
	\fi%
	%
	\ifx\@autolatex@wtfig@tmp\relax%
		\errmessage{Package autolatex: File not found '#2', needed for figure inclusion.}%
	\else%
		\@autolatex@wtfig@tmp%
	\fi%
	%
	\endgroup%
}

\global\let\includegraphicswtex\includefigurewtex

%----------------------------------------
% IMAGES WITH LAYERS
%----------------------------------------

%\includeanimatedfigure[width=xx,height=yy]{filename}
\global\let\includeanimatedfigure\includegraphicswtex

%----------------------------------------
% IMAGES WITH LAYERS AND COMBINED TEX
%----------------------------------------

%\includeanimatedfigurewtex[width=xx,height=yy]{filename}
\global\let\includeanimatedfigurewtex\includegraphicswtex

\endinput