/usr/share/perl5/LaTeXML/Package/AmSTeX.pool.ltxml is in latexml 0.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | # -*- CPERL -*-
# /=====================================================================\ #
# | AmSTeX.pool | #
# | Implementation for LaTeXML | #
# |=====================================================================| #
# | Part of LaTeXML: | #
# | Public domain software, produced as part of work done by the | #
# | United States Government & not subject to copyright in the US. | #
# |---------------------------------------------------------------------| #
# | Thanks to the arXMLiv group for initial implementation | #
# | http://arxmliv.kwarc.info/ | #
# | Released to the Public Domain | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov> #_# | #
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# This is the `pool' for AmSTeX (_not_ AMS LaTeX)
# It should be loaded by LoadPool("AmSTeX"), or
# indirectly via \input amstex
# (from TeX mode, ie. before and without LaTeX.pool being loaded)
# This should put LaTeXML into "amstex mode"
#
# Since amstex uses \documentstyle, we _must_ define it here to
# keep TeX.pool from anticipating LaTeX mode and loading LaTeX.pool!
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DefConstructorI('\AmSTeX', undef, 'AMSTeX');
DefMacro('\fmtname', 'AmS-TeX');
DefMacro('\fmtversion', '2.1');
Let('\plainfmtversion', '\fmtversion');
DefPrimitive('\define SkipSpaces Token UntilBrace {}', sub {
my ($stomach, $cs, $params, $body) = @_;
$params = parseDefParameters($cs, $params); # in TeX.pool
my $key = "defined:" . Stringify($cs);
Error('ignore', $cs, $stomach,
"Ignoring redefinition (\\define) of '" . Stringify($cs) . "'") if LookupValue($key);
AssignValue($key => 1); # only if defined by \define (or \newcommand!)??? Or ANY \def ???
DefMacroI($cs, $params, $body);
return; });
DefPrimitive('\redefine SkipSpaces Token UntilBrace {}', sub {
my ($stomach, $cs, $params, $body) = @_;
$params = parseDefParameters($cs, $params); # in TeX.pool
my $key = "defined:" . Stringify($cs);
AssignValue($key => 1); # only if defined by \define (or \newcommand!), not \def!
DefMacroI($cs, $params, $body);
return; });
DefPrimitive('\predefine Token Token', sub {
Let($_[1], $_[2]); });
DefPrimitive('\undefine Token', sub {
my ($stomach, $cs) = @_;
my $key = "defined:" . Stringify($cs);
AssignValue($key => 0);
Let($_[1], '\undefined'); });
#======================================================================
# Style choices
DefConstructor('\documentstyle Semiverbatim',
"<?latexml class='#1' amstex='true'?>",
afterDigest => sub {
my ($stomach, $whatsit) = @_;
my $style = ToString($whatsit->getArg(1));
# Load the package, but note that we're pretending it's a class (to some extent!)
RequirePackage($style, type => 'sty', notex => 1, as_class => 1)
|| RequirePackage('amsppt');
return; });
DefMacro('\NoPageNumbers', '');
DefMacro('\BlackBoxes', ''); # These control whether overfull boxes show black; Ignorable
DefMacro('\NoBlackBoxes', '');
DefMacro('\TagsAsMath', '');
DefMacro('\TagsAsText', '');
DefMacro('\TagsOnLeft', '');
DefMacro('\TagsOnRight', '');
DefMacro('\CenteredTagsOnSplits', '');
DefMacro('\TopOrBottomTagsOnSplits', '');
DefMacro('\LimitsOnInts', '');
DefMacro('\NoLimitsOnInts', '');
DefMacro('\LimitsOnNames', '');
DefMacro('\NoLimitsOnNames', '');
DefMacro('\LimitsOnSums', '');
DefMacro('\NoLimitsOnSums', '');
# These presumably load fonts (or commands?)
DefMacro('\UseAMSsymbols', '');
DefMacro('\loadbold', '');
DefMacro('\loadeufb', '');
DefMacro('\loadeufm', '');
DefMacro('\loadeurb', '');
DefMacro('\loadeurm', '');
DefMacro('\loadeusb', '');
DefMacro('\loadeusm', '');
DefMacro('\loadmathfont', '');
DefMacro('\loadmsam', '');
DefMacro('\loadmsbm', '');
DefMacro('\boldnotloaded{}', '');
DefMacro('\galleys', '');
DefMacro('\flushpar', '\par\noindent');
DefMacro('\pagewidth{Dimension}', '');
DefMacro('\pageheight{Dimension}', '');
DefMacro('\hcorrection{Dimension}', '');
DefMacro('\vcorrection{Dimension}', '');
#======================================================================
# The Document
DefConstructor('\document', "<ltx:document>",
afterDigest => sub { AssignValue(inPreamble => 0); });
DefConstructor('\enddocument', "</ltx:document>",
beforeDigest => sub {
$_[0]->getGullet->flush;
return; });
#======================================================================
# Front Matter
DefMacro('\topmatter', '');
DefMacro('\endtopmatter', '');
DefMacro('\title Until:\endtitle', '\@add@frontmatter{ltx:title}{#1}');
DefConstructor('\@personname{}', "<ltx:personname>#1</ltx:personname>",
bounded => 1, mode => 'text');
DefMacro('\author Until:\endauthor', '\@add@frontmatter{ltx:creator}[role=author]{\@personname{#1}}');
DefConstructor('\@institute{}', "<ltx:contact role='institute'>#1</ltx:contact>", bounded => 1);
DefMacro('\thanks Until:\endthanks', '\@add@to@frontmatter{ltx:creator}{\@institute{#1}}');
DefMacro('\abstract Until:\endabstract', '\@add@frontmatter{ltx:abstract}{#1}');
#======================================================================
# Document structure
# See amsppt.sty or ...
DefMacro('\nofrills', '');
DefPrimitive('\comment', sub {
my ($stomach, $line);
my $gullet = $stomach->getGullet;
$gullet->readRawLine; # IGNORE 1st line (after the \begin{$name} !!!
while (defined($line = $gullet->readRawLine) && ($line ne '\endcomment')) {
}
return; });
Let('\plainproclaim', '\proclaim');
Let('\plainfootnote', '\footnote');
RawTeX('\newbox\tocbox@');
#======================================================================
# Text level stuff
DefMacro('\newline', "\n");
DefPrimitiveI('\textfonti', undef, '',
font => { family => 'serif', series => 'medium', shape => 'upright' });
DefPrimitiveI('\textfontii', undef, '',
font => { family => 'serif', series => 'medium', shape => 'upright', size => 'small' });
DefConstructor('\spreadlines Dimension', '');
DefPrimitive('\pagebreak', undef);
DefPrimitive('\nopagebreak', undef);
DefPrimitive('\smallpagebreak', undef);
DefPrimitive('\medpagebreak', undef);
DefPrimitive('\bigpagebreak', undef);
DefPrimitive('\allowlinebreak', undef);
DefPrimitive('\allowmathbreak', undef);
DefPrimitive('\linebreak', undef);
DefPrimitive('\nolinebreak', undef);
DefPrimitive('\mathbreak', undef);
DefPrimitive('\nomathbreak', undef);
DefPrimitive('\allowdisplaybreaks', undef);
DefPrimitive('\allowdisplaybreak', undef);
DefMacro('\tie', '\unskip\nobreak\ ');
Let('\graveaccent', "\\`");
Let('\acuteaccent', "\\'");
Let('\tildeaccent', "\\~");
Let('\hataccent', "\\^");
Let('\underscore', "\\_");
Let('\B', "\\=");
Let('\D', "\\.");
DefMacro('\.', '. ');
#======================================================================
# Math stuff.
# We'd like to be able to leverage the ams (LaTeX) packages we've already written.
# However, they were written in the context of LaTeX, and assume LaTeX.pool was loaded.
# We either need to duplicate them, or alter them to be aware of LaTeX vs AMSTeX mode!
# Especially, DefEnvironment is to be avoided! (or usurped!!)
# We need stuff from amsmath, BUT it shouldn't define "environments",
# rather \foo ... \endfoo....
# But, of course, DefEnvironment, DOES do that!
# Will this work????
# The question is whether AMSTeX's \foo..\endfoo incorporates \begingroup/\endgroup pairs?
# MOST Likely, all of amsmath will need to be redone here, since the argument patterns are
# so different! The rest are probably OK.
RequirePackage('amsmath');
RequirePackage('amssymb');
RequirePackage('amsfonts');
RequirePackage('amsopn');
RequirePackage('amsxtra');
RequirePackage('amscd');
Let('\dsize', '\displaystyle');
Let('\tsize', '\textstyle');
Let('\ssize', '\scriptstyle');
Let('\sssize', '\scriptscriptstyle');
DefMath('\and', '\&', role => 'ADDOP', meaning => 'and');
DefConstructor("\\\\",
"?#isMath(<ltx:XMHint name='newline'/>)(<ltx:break/>)",
reversion => Tokens(T_CS("\\\\"), T_CR));
# This is an analog to \align's template, but hopefully we can just ignore it???
DefMacro("\\format Until:\\\\", '');
DefConstructor('\text {}',
"<ltx:text _noautoclose='1'>#1</ltx:text>", mode => 'text');
DefConstructor('\overset Until:\to {}',
"<ltx:XMApp>"
. "<ltx:XMWrap role='OVERACCENT'>#1</ltx:XMWrap>"
. "<ltx:XMArg>#2</ltx:XMArg>"
. "</ltx:XMApp>");
DefConstructor('\underset Until:\to {}',
"<ltx:XMApp>"
. "<ltx:XMWrap role='UNDERACCENT'>#1</ltx:XMWrap>"
. "<ltx:XMArg>#2</ltx:XMArg>"
. "</ltx:XMApp>");
DefMacro('\oversetbrace Until:\to {}', '\overbrace{#2}^{#1}');
DefMacro('\undersetbrace Until:\to {}', '\underbrace{#2}^{#1}');
Let('\overarrow', '\overrightarrow');
Let('\underarrow', '\underrightarrow');
DefConstructor('\frac{}{}',
"<ltx:XMApp>"
. "<ltx:XMTok meaning='divide' role='MULOP' mathstyle='#mathstyle'/>"
. "<ltx:XMArg>#1</ltx:XMArg><ltx:XMArg>#2</ltx:XMArg>"
. "</ltx:XMApp>",
);
DefConstructor('\Cal{}', '#1', bounded => 1, requireMath => 1,
font => { family => 'caligraphic', series => 'medium', shape => 'upright' });
# \bold in amsfonts
DefConstructor('\roman{}', '#1', bounded => 1, requireMath => 1,
font => { family => 'serif', series => 'medium', shape => 'upright' });
DefConstructor('\italic{}', '#1', bounded => 1, requireMath => 1,
font => { shape => 'italic', series => 'medium', shape => 'upright' });
DefConstructor('\slanted{}', '#1', bounded => 1, requireMath => 1,
font => { shape => 'slanted', series => 'medium', shape => 'upright' });
DefConstructor('\boldkey{}', '#1', bounded => 1, requireMath => 1,
font => { series => 'bold', family => 'typewriter', series => 'medium', shape => 'upright' });
# holy cow...
DefMacro('\thickfrac', sub {
($_[0]->ifNext('\thickness') ? T_CS('\@thickfrac') : T_CS('\frac')); });
DefMacro('\@thickfrac Token Number {}{}', '\genfrac{}{}{#2}{}{#3}{#4}');
DefMacro('\thickfracwithdelims{}{}', sub {
(($_[0]->ifNext('\thickness') ? T_CS('\@thickfracwithdelims') : T_CS('\fracwithdelims')), $_[1], $_[2]); });
DefMacro('\@thickfracwithdelims {}{} Token Number {}{}', '\genfrac{#1}{#2}{#4}{}{#5}{#6}');
DefMacro('\spcheck', '^{\vee}');
DefMacro('\sptilde', '^{\sim}');
DefMacro('\spacute', "^{'}");
DefMacro('\spgrave', "^{`}");
DefMacro('\spdot', "^{.}");
DefMacro('\spddot', "^{..}");
DefMacro('\spdddot', "^{...}");
DefMacro('\spddddot', "^{....}");
DefMacro('\spbreve', "^{\\hbox{\\u{}}}");
DefMacro('\spbar', "^{-}");
DefMacro('\spvec', "^{\\rightarrow}");
# Ignore these?
DefRegister('\buffer' => Dimension(0));
DefMacro('\ChangeBuffer Dimension', '\buffer#2\relax');
DefMacro('\ResetBuffer', '');
DefMacro('\shave{}', '#1');
DefMacro('\botshave{}', '#1');
DefMacro('\topshave{}', '#1');
DefMacro('\minCDarrowwidth Dimension', '');
DefMacro('\pretend Until:\haswidth {}', '#1');
DefMacro('\snug', '');
DefConstructor('\topsmash{}', "#1");
DefConstructor('\botsmash{}', "#1");
DefConstructor('\spreadmatrixlines Dimension', '');
DefMacro('\MultlineGap Dimension', '');
DefMacro('\multlinegap Dimension', '');
DefMacro('\nomultlinegap', '');
DefMacro('\innerhdotsfor Number Match:\after {}', sub {
(map { '\hdots' } 1 .. $_[1]->valueOf); });
DefMacro('\spacehdots Number Match:\for Number', sub {
(map { '\hdots' } 1 .. $_[1]->valueOf); });
DefMacro('\spaceinnerhdots Number Match:\for Number Match:\after {}', sub {
(map { '\hdots' } 1 .. $_[1]->valueOf); });
DefMacro('\foldedtext', sub {
my ($gullet) = @_;
if ($gullet->ifNext('\foldedwidth')) {
$gullet->readToken; $gullet->readDimension; } # ignore?
T_CS('\text'); });
Let('\topfoldedtext', '\foldedtext');
Let('\botfoldedtext', '\foldedtext');
# Maybe?
DefMacro('\Sb Until:\endSb', '_{\substack{#1}}');
DefMacro('\Sp Until:\endSp', '^{\substack{#1}}');
Let('\endSb', '\relax');
Let('\endSp', '\relax');
DefMacro('\thetag', sub { T_OTHER(LookupValue('EQUATIONROW_NUMBER')); }); # ?
DefMacro('\topaligned', '\aligned[t]');
Let('\endtopaligned', '\endaligned');
DefMacro('\botaligned', '\aligned[b]');
Let('\endbotaligned', '\endaligned');
# close enough?
DefMacro('\accentedsymbol{}{}', '\def#1{#2}');
# Tricky:
# \cfrac, \lcfrac, \endcfrac
DefRegister('\cfraccount@' => Number(0));
DefPrimitive('\@cfracstyle{}', sub { AssignValue(CFRACSTYLE => ToString($_[1])); });
DefMacro('\cfrac', '\bgroup\@cfracstyle{c}\advance\cfraccount@ 1\let\\\@cfrac');
DefMacro('\lcfrac', '\bgroup\@cfracstyle{l}\advance\cfraccount@ 1\let\\\@cfrac');
DefMacro('\rcfrac', '\bgroup\@cfracstyle{r}\advance\cfraccount@ 1\let\\\@cfrac');
DefConstructorI('\@cfrac', undef,
"<ltx:XMApp>"
. "<ltx:XMTok meaning='continued-fraction' mathstyle='#mathstyle' role='MULOP'/>"
. "<ltx:XMArg>#top</ltx:XMArg>"
. "<ltx:XMArg>#bottom</ltx:XMArg>"
. "</ltx:XMApp>",
afterDigest => \&chooseArgHandler,
properties => sub { (mathstyle => LookupValue('CFRACSTYLE')); },
reversion => sub {
my ($whatsit) = @_;
(T_CS('\cfrac'),
Revert($whatsit->getProperty('top')),
T_CS("\\\\"),
Revert($whatsit->getProperty('bottom'))); });
DefMacro('\endcfrac', sub {
((map { T_CS('\egroup') } 1 .. LookupValue('\cfraccount@')->valueOf), T_CS('\@endcfrac')); });
DefConstructor('\@endcfrac', '', reversion => '\endcfrac');
#======================================================================
# Bibliography
# See amsppt.sty
#======================================================================
# Dubious
DefMacro('\printoptions', '');
DefMacro('\showallocations', '');
DefMacro('\syntax', '');
1;
|