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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
#! /usr/bin/env perl
# Convert MnSymbol.sty to a faked version which does not require
# the definition of any additional math alphabets
#
# By Scott Pakin <scott.clsl@pakin.org>
use POSIX;
use warnings;
use strict;
# Output some header boilerplate.
print "\%" x 43, "\n";
print "\% This is a generated file. DO NOT EDIT. \%\n";
print "\%" x 43, "\n";
print "\n";
print strftime("\\ProvidesPackage{fakeMnSymbol}[\%Y/\%m/\%d v1.0 faked version of MnSymbol.sty]\n", localtime());
print <<'MACRODEFS';
% Construct a text-sized delimiter from its constituent characters.
\DeclareRobustCommand{\MNSfaketdelim}[3]{%
\begingroup
\def\char@in@box##1{%
\setbox0=\hbox{\char##1}%
\hbox{%
\vrule width \wd0 height 0pt depth 0pt
\vrule width 0pt height \ht0 depth \dp0
\smash{\box0}%
}%
\vspace*{-1pt}% Why is this necessary?
}%
\offinterlineskip
\vbox{%
\halign{##\cr
\char@in@box{#1}\cr % top
\char@in@box{#2}\cr % mid
\char@in@box{#3}\cr % bot
}%
}%
\endgroup
}
% Construct a display-sized delimiter from its constituent characters.
\DeclareRobustCommand{\MNSfakeddelim}[4]{%
\begingroup
\def\char@in@box##1{%
\setbox0=\hbox{\char##1}%
\hbox{%
\vrule width \wd0 height 0pt depth 0pt
\vrule width 0pt height \ht0 depth \dp0
\smash{\box0}%
}%
\vspace*{-1pt}% Why is this necessary?
}%
\offinterlineskip
\vbox to 4ex{%
\halign{##\cr
\char@in@box{#1}\cr % top
\char@in@box{#4}\cr % rep
\char@in@box{#4}\cr % rep
\char@in@box{#2}\cr % mid
\char@in@box{#4}\cr % rep
\char@in@box{#4}\cr % rep
\char@in@box{#3}\cr % bot
}%
\vss
}%
\endgroup
}
% Given a math expression, a small accent character, and a large
% accent character, typeset the expression with the appropriate-sized
% accent above it.
\DeclareRobustCommand{\MNSfakewidetopaccent}[5]{%
\setbox0=\hbox{\ensuremath{#1}}%
\setbox1=\hbox{\ensuremath{abc}}%
\ifdim\wd0<\wd1
\rlap{\raisebox{#2}{\makebox[\wd0]{\usefont{U}{MnSymbolE}{m}{n}\char#3}}}%
\else
\rlap{\raisebox{#4}{\makebox[\wd0]{\usefont{U}{MnSymbolE}{m}{n}\char#5}}}%
\fi
\box0\relax
}
MACRODEFS
;
# Read the font metrics for the largesymbol font in preparation for
# faking the variable-sized delimiters.
my $tfmfile = `kpsewhich MnSymbolE10.tfm`;
my @nextlarger; # Map from a character number to the next larger character
my @varchar; # Map from a character number to a varchar hash
if ($tfmfile ne "") {
chomp $tfmfile;
open (LARGESYMBOLS, "tftopl $tfmfile|") || die "tftopl $tfmfile: $!\n";
my $charnum = -1; # Character number of the current character
while (my $oneline = <LARGESYMBOLS>) {
chomp $oneline;
if ($oneline =~ /^\(CHARACTER ([CO]) (\w+)/) {
$charnum = $1 eq "O" ? oct($2) : ord($2);
}
elsif ($oneline =~ /\(NEXTLARGER ([CO]) (\w+)/) {
$nextlarger[$charnum] = $1 eq "O" ? oct($2) : ord($2);
}
elsif ($oneline =~ /\((TOP|MID|BOT|REP) ([CO]) (\w+)/) {
$varchar[$charnum]->{$1} = $2 eq "O" ? oct($3) : ord($3);
}
}
close LARGESYMBOLS;
}
# Process each symbol declaration in turn.
my $slot = 0;
my %families;
while (<>) {
# Process all symbols defined with \Decl@Mn@Char.
/\\Set\@Mn\@Sym\{(\d+)\}/ && do {$slot=0+$1; next};
/^\\Decl\@Mn\@Char\\@?(\w+)\s*\{(\w+)\}/ && do {
my $symname = $1;
my $family = $2;
if ($family =~ /^MnSy(\w)$/) {
$family = "MnSymbol" . $1;
}
elsif ($family eq "symbols") {
$family = "MnSymbolF";
}
else {
die "${0}: unrecognized symbol family \"$family\"\n";
}
if (!defined $families{$family}) {
$families{$family}++;
print "\n";
print "\\DeclareFontFamily{U}{$family}{}\n";
print "\\DeclareFontShape{U}{$family}{m}{n}{<-> ${family}10}{}\n";
}
print "\\DeclareRobustCommand{\\MNS$symname}";
print "{\\mbox{\\usefont{U}{$family}{m}{n}\\char$slot}}\n";
$slot++;
};
# Process variable-sized symbols specially.
/^\\Decl\@Mn\@(Open|Close|Delim)\s*\{([^\}]+)\}.*\{\'(\d+)\}\s*$/ && do {
my $charnum = oct $3;
my %sym2name = ("[" => "lbracket",
"]" => "rbracket",
"|" => "pipe",
"<" => "less",
">" => "greater",
"/" => "slash",
"(" => "lparen",
")" => "rparen");
my $symname = substr($2, 0, 1) eq "\\" ? substr($2, 1) : $sym2name{$2};
my $family = "MnSymbolE";
if (!defined $families{$family}) {
$families{$family}++;
print "\n";
print "\\DeclareFontFamily{U}{$family}{}\n";
print "\\DeclareFontShape{U}{$family}{m}{n}{<-> ${family}10}{}\n";
}
my $tcharnum; # Character number of the \big symbol size
my $dcharnum; # Character number of the variable-sized symbol
$tcharnum = defined $nextlarger[$charnum] ? $nextlarger[$charnum] : $charnum;
for ($dcharnum=$tcharnum; defined $nextlarger[$dcharnum]; $dcharnum=$nextlarger[$dcharnum]) {
}
# Define the text-sized version of the delimiter.
print "\\DeclareRobustCommand{\\MNSt$symname}";
print "{\\mbox{\\usefont{U}{$family}{m}{n}";
if (defined $varchar[$tcharnum]) {
# Even the \big size is variable-sized.
my $rep = $varchar[$tcharnum]->{REP};
my $top = $varchar[$tcharnum]->{TOP} || $rep;
my $bot = $varchar[$tcharnum]->{BOT} || $rep;
my $mid = $varchar[$tcharnum]->{MID} || $rep;
print "\\MNSfaketdelim{$top}{$mid}{$bot}";
}
else {
print "\\char$tcharnum";
}
print "}}\n";
# Define the display-sized version of the delimiter.
print "\\DeclareRobustCommand{\\MNSd$symname}";
print "{\\mbox{\\usefont{U}{$family}{m}{n}";
my $rep = $varchar[$dcharnum]->{REP};
if (defined $rep) {
my $top = $varchar[$dcharnum]->{TOP} || $rep;
my $bot = $varchar[$dcharnum]->{BOT} || $rep;
my $mid = $varchar[$dcharnum]->{MID} || $rep;
print "\\MNSfakeddelim{$top}{$mid}{$bot}{$rep}";
}
else {
print "\\char$dcharnum";
}
print "}}\n";
};
}
# Output some trailer boilerplate.
print <<'TRAILER';
% Redefine some problematic symbols.
\DeclareRobustCommand{\MNSdlparen}{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char140}}
\DeclareRobustCommand{\MNSdrparen}{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char145}}
% The following symbols were renamed and adapted from MnSymbol.sty.
\let\MNSrelbar=\MNSleftrightline
\DeclareRobustCommand\MNSjoinrel{\mathrel{\mkern-12.4mu}}
\DeclareRobustCommand\MNSlongrightarrow{\DOTSB\MNSleftrightline\MNSjoinrel\MNSrightarrow}
\DeclareRobustCommand\MNSlongleftarrow{\DOTSB\MNSleftarrow\MNSjoinrel\MNSleftrightline}
\DeclareRobustCommand\MNSlongleftrightarrow{\DOTSB\MNSleftarrow\MNSjoinrel\MNSrightarrow}
\DeclareRobustCommand\MNSLongrightarrow{\DOTSB\MNSLeftrightline\MNSjoinrel\MNSRightarrow}
\DeclareRobustCommand\MNSLongleftarrow{\DOTSB\MNSLeftarrow\MNSjoinrel\MNSLeftrightline}
\DeclareRobustCommand\MNSLongleftrightarrow{\DOTSB\MNSLeftarrow\MNSjoinrel\MNSRightarrow}
\DeclareRobustCommand\MNSlongmapsto{\DOTSB\MNSleftfootline\MNSjoinrel\MNSrightarrow}
\DeclareRobustCommand\MNSemptyfilledspoon{\DOTSB\MNSleftspoon\mkern-13mu\MNSrightfilledspoon}
\DeclareRobustCommand\MNSfilledemptyspoon{\DOTSB\MNSleftfilledspoon\mkern-13mu\MNSrightspoon}
\DeclareRobustCommand\MNSlargeemptyfilledspoon{\DOTSB\mathrel{\MNScirc\mkern-3mu\MNSrelbar\mkern-3mu\MNSbullet}}
\DeclareRobustCommand\MNSlargefilledemptyspoon{\DOTSB\mathrel{\MNSbullet\mkern-3mu\MNSrelbar\mkern-3mu\MNScirc}}
% The following accents were renamed and adapted from MnSymbol.sty.
\DeclareRobustCommand{\MNSoverbrace}[1]{\MNSfakewidetopaccent{#1}{1.5ex}{'251}{2.1ex}{'253}}
\DeclareRobustCommand{\MNSunderbrace}[1]{\MNSfakewidetopaccent{#1}{-1.7ex}{'256}{-1.7ex}{'260}}
\DeclareRobustCommand{\MNSwidehat}[1]{\MNSfakewidetopaccent{#1}{0ex}{'302}{0.6ex}{'303}}
\DeclareRobustCommand{\MNSwidetilde}[1]{\MNSfakewidetopaccent{#1}{0ex}{'307}{0.6ex}{'310}}
\DeclareRobustCommand{\MNSwideparen}[1]{\MNSfakewidetopaccent{#1}{0ex}{'314}{0.6ex}{'315}}
\DeclareRobustCommand{\MNSvec}[1]{\MNSfakewidetopaccent{#1}{0ex}{'321}{0ex}{'321}}
\def\MNSlinesegmentfill@{\arrowfill@\MNSleftfootline\MNSrelbar\MNSrightfootline}
\def\MNSleftharpoonfill@{\arrowfill@\MNSleftharpooncw\MNSrelbar\MNSrelbar}
\def\MNSrightharpoonfill@{\arrowfill@\MNSrelbar\MNSrelbar\MNSrightharpoonccw}
\DeclareRobustCommand{\MNSoverlinesegment}{\mathpalette{\overarrow@\MNSlinesegmentfill@}}
\DeclareRobustCommand{\MNSoverleftharpoon}{\mathpalette{\overarrow@\MNSleftharpoonfill@}}
\DeclareRobustCommand{\MNSoverrightharpoon}{\mathpalette{\overarrow@\MNSrightharpoonfill@}}
\DeclareRobustCommand{\MNSunderlinesegment}{\mathpalette{\underarrow@\MNSlinesegmentfill@}}
\def\MNSbracefill@#1#2#3#4#5{$\m@th#5#1\leaders\hbox{$#4$}\hfill#2\leaders\hbox{$#4$}\hfill#3$}
\def\MNSdowngroupfill@{\MNSbracefill@\MNSbraceld{}\MNSbracerd\MNSbracemid}
\def\MNSupgroupfill@{\MNSbracefill@\MNSbracelu{}\MNSbraceru\MNSbracemid}
\def\MNSoverbrace@#1#2#3{\vbox{\m@th\ialign{##\crcr
#1#2\crcr\noalign{\kern2\p@\nointerlineskip}%
$\m@th\hfil#2#3\hfil$\crcr}}}
\def\MNSunderbrace@#1#2#3{\vtop{\m@th\ialign{##\crcr
$\m@th\hfil#2#3\hfil$\crcr
\noalign{\kern2\p@\nointerlineskip}%
#1#2\crcr}}}
\def\MNSbraceld{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char'263}}
\def\MNSbracelu{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char'264}}
\def\MNSbracerd{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char'265}}
\def\MNSbraceru{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char'266}}
\def\MNSbracemid{\mbox{\usefont{U}{MnSymbolE}{m}{n}\char'271}}
\DeclareRobustCommand{\MNSovergroup}{\mathpalette{\MNSoverbrace@\MNSdowngroupfill@}}
\DeclareRobustCommand{\MNSundergroup}{\mathpalette{\MNSunderbrace@\MNSupgroupfill@}}
\endinput
TRAILER
;
|