-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipe.sty
193 lines (193 loc) · 5.54 KB
/
ipe.sty
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
%
% Integrated Picture Environment, Version 5.0
%
% Last $Modified: Thursday, March 16, 1995 by otfried $
%
\edef\IPEtheAtCatcode{\the\catcode`\@}
\makeatletter
%
\newif\if@IPE@ldLatex
%
\@ifundefined{NeedsTeXFormat}{
% LaTeX 2.09
\typeout{Style-Option: `ipe' v5.0 for inclusion of Ipe figures}
% if no NFSS, disable font size selection
\@ifundefined{selectfont}{\def\fontsize#1#2{}\let\selectfont\relax}{}
\@IPE@ldLatextrue
}{
% LaTeX2e
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ipe}
[1995/03/16 v5.0 LaTeX2e package for inclusion of Ipe figures]
\typeout{Package: `ipe' v5.0 for inclusion of Ipe figures}
\@IPE@ldLatexfalse
}
%
% ----------------------------------------------------------------------
%
% Package options (in LaTeX2e)
%
\if@IPE@ldLatex\else
\DeclareOption{nocolor}{\def\color[##1]##2{}}
\ProcessOptions
\fi
%
% ----------------------------------------------------------------------
%
% If the \color command (as in the Latex2e color package) is
% defined, we use that to generate colors, otherwise we create
% \specials for dvips.
% If \includegraphics (is in the Latex2e graphicx package) is defined,
% we use that to include the Postscript part, otherwise we again
% create dvips specials.
%
\@ifundefined{color}{%
% Dvips specials
\def\IPEcolor[#1]#2{\special{color push #1 #2}\aftergroup\IPE@reset}%
\def\IPE@reset{\special{color pop}}}{%
% just use \color
\let\IPEcolor\color}
%
\@ifundefined{includegraphics}{%
% \includegraphics not defined, use \specials
\def\IPEput#1#2#3#4{\put(0,0){\special{psfile=\IPEfile\space
hscale=\IPEscale\space vscale=\IPEscale}}}}{%
% graphicx definition
\DeclareGraphicsRule{ipe}{eps}{}{}
\def\IPEput#1#2#3#4{\put(#1,#2){%
\includegraphics[bb=#1 #2 #3 #4,width=\IPEwidth]{\IPEfile}}}}
%
% ----------------------------------------------------------------------
%
% The complicated test is for compatibility with old Ipe versions.
% For Ipe 4.0 and up, the following definition is sufficient:
% \def\Ipe#1{\def\IPEfile{#1}\input{\IPEfile}}
%
\def\Ipe#1{{\def\IPEfile{#1}\begingroup
\catcode`\%=9\catcode`\!=0\catcode`\-=11\input{\IPEfile}}}
{\catcode`\-=11\gdef\PS-Adobe-2.0 EPSF-1.2 {\endgroup}}
%
% ----------------------------------------------------------------------
%
% internal macros: called from Ipe figures, but not by user
%
\newif\if@IPE@scalefont
%
\long\def\IPEmp#1#2{\makebox(0,0)[lt]{\begin{minipage}[t]{#1\unitlength}%
#2\end{minipage}}}
\long\def\IPEtext#1{\makebox(0,0)[lb]{#1}}
%
\def\IPEfs#1{\IPEcolfs{0 0 0}{#1}}
%
\def\IPEcolfs#1#2{\dimen0=#2pt\if@IPE@scalefont
\multiply\dimen0 by \IPEscale\divide\dimen0 by 100\fi
\advance\dimen0 by 0.5pt\count0=\dimen0\divide
\count0 by 65536\csname @IPE@25@fs\endcsname
\csname @IPE@\the\count0@fs\endcsname\selectfont\IPEcolor[rgb]{#1}}
%
% define mapping of fontsizes
%
\def\IpeMap#1#2#3{\expandafter\def
\csname @IPE@#1@fs\endcsname{\fontsize{#2}{#3}}}
%
\IpeMap{0}{5}{6pt}
\IpeMap{1}{5}{6pt}
\IpeMap{2}{5}{6pt}
\IpeMap{3}{5}{6pt}
\IpeMap{4}{5}{6pt}
\IpeMap{5}{5}{6pt}
\IpeMap{6}{6}{7pt}
\IpeMap{7}{7}{8pt}
\IpeMap{8}{8}{9.5pt}
\IpeMap{9}{9}{11pt}
\IpeMap{10}{10}{12pt}
%
% LaTeX2e has a different view of font sizes
%
\if@IPE@ldLatex
\IpeMap{11}{11}{13.6pt}
\IpeMap{12}{12}{14pt}
\IpeMap{13}{12}{14pt}
\IpeMap{14}{14}{18pt}
\IpeMap{15}{14}{18pt}
\IpeMap{16}{17}{22pt}
\IpeMap{17}{17}{22pt}
\IpeMap{18}{17}{22pt}
\IpeMap{19}{20}{25pt}
\IpeMap{20}{20}{25pt}
\IpeMap{21}{20}{25pt}
\IpeMap{22}{20}{25pt}
\IpeMap{23}{25}{30pt}
\IpeMap{24}{25}{30pt}
\IpeMap{25}{25}{30pt}
\else
\IpeMap{11}{10.95}{13.6pt}
\IpeMap{12}{12}{14pt}
\IpeMap{13}{12}{14pt}
\IpeMap{14}{14.4}{18pt}
\IpeMap{15}{14.4}{18pt}
\IpeMap{16}{17.28}{22pt}
\IpeMap{17}{17.28}{22pt}
\IpeMap{18}{17.28}{22pt}
\IpeMap{19}{20.74}{25pt}
\IpeMap{20}{20.74}{25pt}
\IpeMap{21}{20.74}{25pt}
\IpeMap{22}{20.74}{25pt}
\IpeMap{23}{24.88}{30pt}
\IpeMap{24}{24.88}{30pt}
\IpeMap{25}{24.88}{30pt}
\fi
%
% ----------------------------------------------------------------------
%
% Macros visible to the user
%
\newdimen\IPEwidth
%
% scale figure to ARG percent
%
\def\IpeScale#1{\edef\IPEscale{#1}%
\def\IPEsize##1##2{\unitlength=\IPEscale bp%
\divide\unitlength by 100\IPEwidth=##1\unitlength\ignorespaces}%
\ignorespaces}
%
% scale figure such that width becomes ARG
%
\def\IpeFit#1{\def\IPEsize##1##2{\dimen0=##1bp\count0=\dimen0%
\IPEwidth=#1\count1=\IPEwidth
\divide\count0 by 100\divide\count1 by \count0%
\edef\IPEscale{\the\count1}%
\unitlength=\IPEscale bp\divide\unitlength by 100%
\IPEwidth=##1\unitlength\ignorespaces}%
\ignorespaces}
%
% Obey or Not Obey \IpeScale for setting fontsize?
%
\def\IpeScaleFont{\@IPE@scalefonttrue}
\def\IpeNoScaleFont{\@IPE@scalefontfalse}
%
\IpeScale{100}
\IpeScaleFont
%
% ----------------------------------------------------------------------
%
% these definitions are solely for backwards compatibility with
% ancient Ipe versions
%
\def\IPE@Idraw@header#1{\special{header=Idraw.prologue}}
\def\IPE@ipe@header#1{\special{header=Ipe-#1.prologue}}
\def\IPEid#1{\endgroup\catcode`\%=9\ignorespaces}
\def\IPEcreator{\@ifstar{\IPE@@creator}{\IPE@creator}}
\def\IPE@creator#1#2{\csname IPE@#1@header\endcsname{#2}\ignorespaces}
\def\IPE@@creator#1#2{\ignorespaces}
\def\IPEfontsize#1#2{\dimen2=#2pt\multiply\dimen2 by #1\count1=\dimen2
\divide\count1 by 65536\IPEfs{\the\count1}}
\long\def\IPEpar#1#2#3{\IPEmp{#1}{#3}}
\def\IPEspecial{psfile=\IPEfile\space hscale=\IPEscale\space vscale=\IPEscale}
\def\IPEps{\special{\IPEspecial}}
%
\catcode`\@=\IPEtheAtCatcode
\endinput
%
% ----------------------------------------------------------------------
%