1# -*- mode: Perl -*- 2# /=====================================================================\ # 3# | proofwiki | # 4# | LaTeXML Bindings for simulating proofwiki.org's macros | # 5# |=====================================================================| # 6# | Part of LaTeXML: | # 7# | Public domain software, produced as part of work done by the | # 8# | United States Government & not subject to copyright in the US. | # 9# |---------------------------------------------------------------------| # 10# | Bruce Miller <bruce.miller@nist.gov> #_# | # 11# | http://dlmf.nist.gov/LaTeXML/ (o o) | # 12# \=========================================================ooo==U==ooo=/ # 13package LaTeXML::Package::Pool; 14use strict; 15use warnings; 16use LaTeXML::Package; 17 18# Adapated from the MathJax-enabling preamble of proofwiki.org 19# so load texvc.sty.ltxml as a MathJax-approximating prerequisite 20RequirePackage('texvc'); 21 22# ProofWiki preference for this symbol 23DefMacro('\empty', '\varnothing'); 24DefMacro('\P', '\unicode{xb6}'); 25DefMacro('\Alpha', '\unicode{x391}'); 26DefMacro('\Beta', '\unicode{x392}'); 27DefMacro('\Epsilon', '\unicode{x395}'); 28DefMacro('\Zeta', '\unicode{x396}'); 29DefMacro('\Eta', '\unicode{x397}'); 30DefMacro('\Iota', '\unicode{x399}'); 31DefMacro('\Kappa', '\unicode{x39a}'); 32DefMacro('\Mu', '\unicode{x39c}'); 33DefMacro('\Nu', '\unicode{x39d}'); 34DefMacro('\Pi', '\unicode{x3a0}'); 35DefMacro('\Rho', '\unicode{x3a1}'); 36DefMacro('\Sigma', '\unicode{x3a3}'); 37DefMacro('\Tau', '\unicode{x3a4}'); 38DefMacro('\Chi', '\unicode{x3a7}'); 39DefMacro('\bsalpha', '\boldsymbol \alpha'); 40DefMacro('\bsbeta', '\boldsymbol \beta'); 41DefMacro('\bsgamma', '\boldsymbol \gamma'); 42DefMacro('\bsdelta', '\boldsymbol \delta'); 43DefMacro('\bsepsilon', '\boldsymbol \epsilon'); 44DefMacro('\bszeta', '\boldsymbol \zeta'); 45DefMacro('\bseta', '\boldsymbol \eta'); 46DefMacro('\bstheta', '\boldsymbol \theta'); 47DefMacro('\bsiota', '\boldsymbol \iota'); 48DefMacro('\bskappa', '\boldsymbol \kappa'); 49DefMacro('\bslambda', '\boldsymbol \lambda'); 50DefMacro('\bsmu', '\boldsymbol \mu'); 51DefMacro('\bsnu', '\boldsymbol \nu'); 52DefMacro('\bsxi', '\boldsymbol \xi'); 53DefMacro('\bsomicron', '\boldsymbol \omicron'); 54DefMacro('\bspi', '\boldsymbol \pi'); 55DefMacro('\bsrho', '\boldsymbol \rho'); 56DefMacro('\bssigma', '\boldsymbol \sigma'); 57DefMacro('\bstau', '\boldsymbol \tau'); 58DefMacro('\bsupsilon', '\boldsymbol \upsilon'); 59DefMacro('\bsphi', '\boldsymbol \phi'); 60DefMacro('\bschi', '\boldsymbol \chi'); 61DefMacro('\bspsi', '\boldsymbol \psi'); 62DefMacro('\bsomega', '\boldsymbol \omega'); 63# the pound symbol unaccountably missing from mathjax 64DefMacro('\pounds', '{\it\unicode{xA3}}'); 65# the complex numbers 66DefMacro('\C', '\mathbb C'); 67# the natural numbers 68DefMacro('\N', '\mathbb N'); 69# the rational numbers 70DefMacro('\Q', '\mathbb Q'); 71# the real numbers 72DefMacro('\R', '\mathbb R'); 73# the integer numbers 74DefMacro('\Z', '\mathbb Z'); 75# the empty set 76DefMacro('\O', '\varnothing'); 77 78# some extra macros for ease of use; these are non-standard! 79 80# true 81DefMacro('\T', '\mathrm T'); 82# false 83DefMacro('\F', '\mathrm F'); 84# Galois field 85DefMacro('\GF', '\mathbb F'); 86# ring of Hamiltonians 87DefMacro('\H', '\mathbb H'); 88# vector of zeros 89DefMacro('\bszero', '\boldsymbol 0'); 90# vector of ones 91DefMacro('\bsone', '\boldsymbol 1'); 92# a vector 't' 93DefMacro('\bst', '\boldsymbol t'); 94# a vector 'v' 95DefMacro('\bsv', '\boldsymbol v'); 96# a vector 'w' 97DefMacro('\bsw', '\boldsymbol w'); 98# a vector 'x' 99DefMacro('\bsx', '\boldsymbol x'); 100# a vector 'y' 101DefMacro('\bsy', '\boldsymbol y'); 102# a vector 'z' 103DefMacro('\bsz', '\boldsymbol z'); 104# a vector '\Delta' 105DefMacro('\bsDelta', '\boldsymbol \Delta'); 106# the exponential 107DefMacro('\E', '\mathrm e'); 108# roman d for use in integrals: $\int f(x) \rd x$ 109DefMacro('\rd', '\,\mathrm d'); 110# roman d for use in derivatives: $\dfrac \d{\d x}$ 111DefMacro('\d', '\mathrm d'); 112# delta operator for use in sums 113DefMacro('\rdelta', '\,\delta'); 114# differential operator D 115DefMacro('\rD', '\mathrm D'); 116 117# example from MathJax on how to define macros with parameters: 118DefMacro('\bold{}', '{\bf #1}'); 119 120DefMacro('\AA', '\mathcal A'); 121DefMacro('\BB', '\mathcal B'); 122DefMacro('\CC', '\mathcal C'); 123DefMacro('\DD', '\mathcal D'); 124DefMacro('\EE', '\mathcal E'); 125DefMacro('\FF', '\mathcal F'); 126DefMacro('\GG', '\mathcal G'); 127DefMacro('\HH', '\mathcal H'); 128DefMacro('\II', '\mathcal I'); 129DefMacro('\JJ', '\mathcal J'); 130DefMacro('\KK', '\mathcal K'); 131DefMacro('\LL', '\mathcal L'); 132DefMacro('\MM', '\mathcal M'); 133DefMacro('\NN', '\mathcal N'); 134DefMacro('\OO', '\mathcal O'); 135DefMacro('\PP', '\mathcal P'); 136DefMacro('\QQ', '\mathcal Q'); 137DefMacro('\RR', '\mathcal R'); 138DefMacro('\SS', '\mathcal S'); 139DefMacro('\TT', '\mathcal T'); 140DefMacro('\UU', '\mathcal U'); 141DefMacro('\VV', '\mathcal V'); 142DefMacro('\WW', '\mathcal W'); 143DefMacro('\XX', '\mathcal X'); 144DefMacro('\YY', '\mathcal Y'); 145DefMacro('\ZZ', '\mathcal Z'); 146 147DefMacro('\lcm', '\operatorname{lcm}'); 148 149# Otherwise undefined trigometrical and hyperbolic functions 150 151DefMacro('\cosec', '\operatorname{cosec}'); 152DefMacro('\sech', '\operatorname{sech}'); 153DefMacro('\csch', '\operatorname{csch}'); 154DefMacro('\arccot', '\operatorname{arccot}'); 155DefMacro('\arccsc', '\operatorname{arccsc}'); 156DefMacro('\arcsec', '\operatorname{arcsec}'); 157DefMacro('\hav', '\operatorname{hav}'); 158DefMacro('\vers', '\operatorname{vers}'); 159DefMacro('\cis', '\operatorname{cis}'); 160DefMacro('\Ci', '\operatorname{Ci}'); 161DefMacro('\Si', '\operatorname{Si}'); 162DefMacro('\Li', '\operatorname{Li}'); 163DefMacro('\Ei', '\operatorname{Ei}'); 164DefMacro('\Sinh', '\operatorname{Sinh}'); 165DefMacro('\Cosh', '\operatorname{Cosh}'); 166DefMacro('\Sech', '\operatorname{Sech}'); 167DefMacro('\Csch', '\operatorname{Csch}'); 168DefMacro('\Tanh', '\operatorname{Tanh}'); 169DefMacro('\Coth', '\operatorname{Coth}'); 170DefMacro('\arsinh', '\operatorname{arsinh}'); 171DefMacro('\arcosh', '\operatorname{arcosh}'); 172DefMacro('\artanh', '\operatorname{artanh}'); 173DefMacro('\arcoth', '\operatorname{arcoth}'); 174DefMacro('\arsech', '\operatorname{arsech}'); 175DefMacro('\arcsch', '\operatorname{arcsch}'); 176DefMacro('\Arsinh', '\operatorname{Arsinh}'); 177DefMacro('\Arcosh', '\operatorname{Arcosh}'); 178DefMacro('\Artanh', '\operatorname{Artanh}'); 179DefMacro('\Arcoth', '\operatorname{Arcoth}'); 180DefMacro('\Arsech', '\operatorname{Arsech}'); 181DefMacro('\Arcsch', '\operatorname{Arcsch}'); 182DefMacro('\erf', '\operatorname{erf}'); 183DefMacro('\erfc', '\operatorname{erfc}'); 184 185# Bracketing constructs 186 187DefMacro('\paren{}', '\left( #1 \right)'); 188DefMacro('\leftparen{}', '\left( #1 \right.'); 189DefMacro('\rightparen{}', '\left. #1 \right)'); 190DefMacro('\sqbrk{}', '\left[ #1 \right]'); 191 192DefMacro('\set{}', '\left\lbrace #1 \right\rbrace'); 193DefMacro('\leftset{}', '\left\lbrace #1 \right.'); 194DefMacro('\rightset{}', '\left. #1 \right\rbrace'); 195DefMacro('\cmod{}', '\left\lvert #1 \right\rvert'); 196DefMacro('\polar{}', '\left\langle #1 \right\rangle'); 197DefMacro('\norm{}', '\left\lVert #1 \right\rVert'); 198DefMacro('\floor{}', '\left\lfloor #1 \right\rfloor'); 199DefMacro('\ceiling{}', '\left\lceil #1 \right\rceil'); 200DefMacro('\nint{}', '\left\lfloor #1 \right\rceil'); 201 202DefMacro('\closedint{}{}', '\left[ #1 \,.\,.\, #2 \right]'); 203DefMacro('\openint{}{}', '\left( #1 \,.\,.\, #2 \right)'); 204DefMacro('\hointl{}{}', '\left( #1 \,.\,.\, #2 \right]'); 205DefMacro('\hointr{}{}', '\left[ #1 \,.\,.\, #2 \right)'); 206DefMacro('\horectl{}{}', '\left(\left( #1 \,.\,.\, #2 \right]\right]'); 207DefMacro('\horectr{}{}', '\left[\left[ #1 \,.\,.\, #2 \right)\right)'); 208DefMacro('\multiset{}', '\left\lbrace\!\left\lbrace #1 \right\rbrace\!\right\rbrace'); 209 210DefMacro('\tuple{}', '\left( #1 \right)'); 211DefMacro('\struct{}', '\left( #1 \right)'); 212DefMacro('\ideal{}', '\left( #1 \right)'); 213DefMacro('\sequence{}', '\left\langle #1 \right\rangle'); 214DefMacro('\family{}', '\left\langle #1 \right\rangle'); 215DefMacro('\innerprod{}{}', '\left\langle #1, #2 \right\rangle'); 216DefMacro('\gen{}', '{\left\langle #1 \right\rangle}'); 217DefMacro('\eqclass{}{}', '\left[\!\left[ #1 \right]\!\right]_{#2}'); 218DefMacro('\index{}{}', '\left[ #1 : #2 \right]'); 219DefMacro('\order{}', '\left\lvert #1 \right\rvert'); 220DefMacro('\size{}', '\left\lvert #1 \right\rvert'); 221DefMacro('\bigsize{}', '\bigl\lvert #1 \bigr\rvert'); 222DefMacro('\card{}', '\left\lvert #1 \right\rvert'); 223DefMacro('\fractpart{}', '\left\lbrace #1 \right\rbrace'); 224DefMacro('\map{}{}', '#1 \left( #2 \right)'); 225DefMacro('\braket{}{}', '{\left\langle #1 \, \middle \vert \, #2 \right\rangle{}}'); 226 227DefMacro('\Syl{}{}', '\mathrm{Syl}_{#1} \left( #2 \right)'); 228DefMacro('\relcomp{}{}', '\complement_{#1} \left( #2 \right)'); 229DefMacro('\laptrans{}', '\LL \left\lbrace #1 \right\rbrace'); 230DefMacro('\invlaptrans{}', '\LL^{-1} \left\lbrace #1 \right\rbrace'); 231DefMacro('\powerset{}', '\PP \left( #1 \right)'); 232DefMacro('\intlimits{}{}{}', '\left[ #1 \right]_{#2}^{#3}'); 233DefMacro('\bigintlimits{}{}{}', '\Bigl[ #1 \Bigr]_{#2}^{#3}'); 234DefMacro('\valueat{}{}', '\left. #1 \right\rvert_{#2}'); 235DefMacro('\bigvalueat{}{}', '\Bigl. #1 \Bigr\rvert_{#2}'); 236 237# Mathematical Logic 238 239DefMacro('\Add', '\operatorname{Add}'); 240DefMacro('\Mult', '\operatorname{Mult}'); 241DefMacro('\Succ', '\operatorname{Succ}'); 242DefMacro('\Zero', '\operatorname{Zero}'); 243 244# Miscellaneous 245 246DefMacro('\hcf', '\operatorname{hcf}'); 247DefMacro('\inj', '\operatorname{inj}'); 248DefMacro('\rem', '\operatorname{rem}'); 249DefMacro('\pr', '\operatorname{pr}'); 250DefMacro('\proj', '\operatorname{proj}'); 251DefMacro('\tr', '\operatorname{tr}'); 252DefMacro('\len', '\operatorname{len}'); 253DefMacro('\sgn', '\operatorname{sgn}'); 254DefMacro('\grad', '\operatorname{grad}'); 255DefMacro('\curl', '\operatorname{curl}'); 256DefMacro('\dr{}', '\mathrm{dr} \left( #1 \right)'); 257DefMacro('\cl', '\mathrm{cl}'); 258DefMacro('\var{}', '\mathsf{var} \left( #1 \right)'); 259DefMacro('\cov{}', '\mathsf{cov} \left( #1 \right)'); 260DefMacro('\expect{}', '\mathsf E \left( #1 \right)'); 261DefMacro('\conjclass{}', '\mathrm C_{#1}'); 262DefMacro('\Log', '\operatorname{Log}'); 263DefMacro('\Ln', '\operatorname{Ln}'); 264DefMacro('\On', '\operatorname{On}'); 265DefMacro('\Area', '\operatorname{Area}'); 266DefMacro('\Card', '\operatorname{Card}'); 267DefMacro('\Frob', '\operatorname{Frob}'); 268DefMacro('\Bernoulli{}', '\mathrm{Bern} \left( #1 \right)'); 269DefMacro('\BetaDist{}{}', '\mathrm{Beta} \left( #1, #2 \right)'); 270DefMacro('\Binomial{}{}', '\mathrm B \left( #1, #2 \right)'); 271DefMacro('\Cauchy{}{}', '\mathrm{Cauchy} \left( #1, #2 \right)'); 272DefMacro('\NegativeBinomial{}{}', '\mathrm{NB} \left( #1, #2 \right)'); 273DefMacro('\Exponential{}', '\mathrm{Exp} \left( #1 \right)'); 274DefMacro('\Gaussian{}{}', 'N \left( #1, #2 \right)'); 275DefMacro('\Geometric{}', '\mathrm G_0 \left( #1 \right)'); 276DefMacro('\ShiftedGeometric{}', '\mathrm G_1 \left( #1 \right)'); 277DefMacro('\Poisson{}', '\mathrm{Poisson} \left( #1 \right)'); 278DefMacro('\StudentT{}', 't_{#1}'); 279DefMacro('\ContinuousUniform{}{}', '\mathrm U \left[ #1 \,.\,.\, #2 \right]'); 280DefMacro('\DiscreteUniform{}', '\mathrm U \left( #1 \right)'); 281DefMacro('\condprob{}{}', '\Pr \left( #1 \, \middle \vert \, #2 \right)'); 282DefMacro('\Arg{}', '\mathrm{Arg} \left( #1 \right)'); 283DefMacro('\domain{}', '\mathrm{Dom} \left( #1 \right)'); 284DefMacro('\cont{}', '\mathrm{cont} \left( #1 \right)'); 285DefMacro('\Dom{}', '\mathrm{Dom} \left( #1 \right)'); 286DefMacro('\Cdm{}', '\mathrm{Cdm} \left( #1 \right)'); 287DefMacro('\Rng{}', '\mathrm{Rng} \left( #1 \right)'); 288DefMacro('\adj{}', '\mathrm{adj} \left( #1 \right)'); 289DefMacro('\Img{}', '\mathrm{Img} \left( #1 \right)'); 290DefMacro('\Preimg{}', '\mathrm{Img}^{-1} \left( #1 \right)'); 291DefMacro('\image{}', '\Img #1 '); 292DefMacro('\Orb{}', '\mathrm{Orb} \left( #1 \right)'); 293DefMacro('\Stab{}', '\mathrm{Stab} \left( #1 \right)'); 294DefMacro('\Dic{}', '\operatorname{Dic}_{#1}'); 295DefMacro('\GL{}', '\mathrm{GL} \left( #1 \right)'); 296DefMacro('\SL{}', '\mathrm{SL} \left (#1 \right)'); 297DefMacro('\SU{}', '\operatorname{SU_{#1} }'); 298DefMacro('\Aut{}', '\mathrm{Aut} \left( #1 \right)'); 299DefMacro('\Out{}', '\mathrm{Out} \left( #1 \right)'); 300DefMacro('\Gal{}', '\mathrm{Gal} \left( #1 \right)'); 301DefMacro('\Inn{}', '\mathrm{Inn} \left( #1 \right)'); 302DefMacro('\Fix{}', '\mathrm{Fix} \left( #1 \right)'); 303DefMacro('\Char{}', '\mathrm{Char} \left( #1 \right)'); 304DefMacro('\Spec{}', '\mathrm{Spec} \left( #1 \right)'); 305DefMacro('\Nil{}', '\mathrm{Nil} \left( #1 \right)'); 306DefMacro('\Ord{}', '\map{\mathrm{Ord} } #1'); 307DefMacro('\Res{}{}', '\mathrm{Res} \left( #1, #2 \right)'); 308DefMacro('\Int{}', '\mathrm{Int} \left( #1 \right)'); 309DefMacro('\Ext{}', '\mathrm{Ext} \left( #1 \right)'); 310DefMacro('\Ber', '\mathrm{Ber}'); 311DefMacro('\Bei', '\mathrm{Bei}'); 312DefMacro('\Rad', '\mathrm{Rad}'); 313DefMacro('\diam', '\mathrm{diam}'); 314DefMacro('\stratgame{}{}{}', '\left\langle #1, \sequence #2, \sequence #3 \right\rangle'); 315DefMacro('\divides', '\mathrel \backslash'); 316DefMacro('\PV', '\mathrm{PV} \displaystyle \int'); 317DefMacro('\leadstoandfrom', '\mathrel \leftrightsquigarrow'); 318DefMacro('\degrees', '^\circ'); 319DefMacro('\radians', '\, \mathrm{rad}'); 320DefMacro('\cels', '\, \degrees \mathrm C'); 321DefMacro('\fahr', '\, \degrees \mathrm F'); 322DefMacro('\Re', '\mathfrak{Re}'); 323DefMacro('\Im', '\mathfrak{Im}'); 324DefMacro('\ds', '\displaystyle'); 325 3261; 327