# -*- mode: Perl -*-
# /=====================================================================\ #
# |  JHEP.cls                                                           | #
# | 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;

# JHEP.cls
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Class Options
# Ignorable options
foreach my $option (qw(proceedings published hyper nohyper notoc)) {
  DeclareOption($option, undef); }

# Anything else gets passed to article.
DeclareOption(undef, sub {
    PassOptions('article', 'cls', ToString(Digest(T_CS('\CurrentOption')))); });

ProcessOptions();

LoadClass('article');
RequirePackage('amssymb');
RequirePackage('floatflt');

#======================================================================
# Frontmatter
DefMacro('\speaker{}', '\@add@frontmatter{ltx:creator}[role=speaker]{\@personname{#1}}');

DefConstructor('\@@@abstract{}', "^ <ltx:abstract name='#name'>#1</ltx:abstract>",
  properties => sub { (name => Digest(T_CS('\abstractname'))); });
DefMacro('\abstract{}', '\@add@to@frontmatter{ltx:abstract}{\@@@abstract{#1}}');

DefConstructor('\@@@email{}', "^ <ltx:contact role='email'>#1</ltx:contact>");
DefMacro('\email Semiverbatim', '\@add@to@frontmatter{ltx:creator}{\@@@email{#1}}');

DefMacro('\received{}',     '\@add@frontmatter{ltx:date}[role=received,name={\receivedname}]{#1}');
DefMacro('\revised{}',      '\@add@frontmatter{ltx:date}[role=revised,name={\revisedname}]{#1}');
DefMacro('\accepted{}',     '\@add@frontmatter{ltx:date}[role=accepted,name={\acceptedname}]{#1}');
DefMacro('\JHEPcopydate{}', '\@add@frontmatter{ltx:date}[role=copydate]{#1}');

DefMacro('\dedicated{}',  '\@add@frontmatter{ltx:note}[role=dedicated]{#1}');
DefMacro('\conference{}', '\@add@frontmatter{ltx:note}[role=conference]{#1}');
DefMacro('\preprint{}',   '\@add@frontmatter{ltx:note}[role=preprint]{#1}');
DefMacro('\keywords{}',   '\@add@frontmatter{ltx:keywords}{#1}');

# There's no explicit "end of acknowledgements"
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
  properties => sub { (name => Digest(T_CS('\acknowlname'))); });
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

#======================================================================
DefPrimitiveI('\hash', undef, '#');
DefMacro('\secstyle',     '\bfseries');
DefMacro('\militarytime', '\time');       # !
Let('\textref', '\ref');                  # ?
DefMacro('\tocsecs', '');
DefMacro('\logo',    'JHEP');
DefMacro('\JHEP{}',  '');                 # ?
DefMacro('\PrHEP{}', '');                 # ?

DefMacro('\Proof', '\emph{Proof.}\ ');

#======================================================================
# Are these close enough?
DefMacro('\FIGURE[]{}', '\begin{floatingfigure}[#1]#2\end{floatingfigure}');
DefMacro('\TABLE[]{}',  '\begin{floatingtable}[#1]#2\end{floatingtable}');
DefMacro('\EPSFIGURE[]{}{}', '\begin{floatingfigure}[#1]\epsfig{file=#2}\caption{#3}\end{floatingfigure}');
DefMacro('\TABULAR[]{}{}{}', '\begin{floatingtable}[#1]\begin{tabular}{#2}#3\end{tabular}\caption{#4}\end{floatingtable}');

DefMacro('\DOUBLEFIGURE[]{}{}{}{}',
  '\begin{figure}[#1]'
    . '\begin{@half@doublefigure}\epsfig{file=#2}\caption{#4}\end{@half@doublefigure}'
    . '\begin{@half@doublefigure}\epsfig{file=#3}\caption{#5}\end{@half@doublefigure}'
    . '\end{figure}');
DefEnvironment('{@half@doublefigure}',
"<ltx:figure refnum='#refnum' frefnum='#frefnum' rrefnum='#rrefnum' xml:id='#id' width='0.45%'>#body</ltx:figure>",
  beforeDigest => sub { DefMacroI('\@captype', undef, 'figure'); },
  afterDigest => sub { RescueCaptionCounters('figure', $_[1]); });

DefMacro('\DOUBLETABLE[]{}{}{}{}',
  '\begin{table}[#1]'
    . '\begin{@half@doubletable}#2\caption{#4}\end{@half@doubletable}'
    . '\begin{@half@doubletable}#3\caption{#5}\end{@half@doubletable}'
    . '\end{table}');
DefEnvironment('{@half@doubletable}',
"<ltx:table refnum='#refnum' frefnum='#frefnum' rrefnum='#rrefnum' xml:id='#id' width='0.45%'>#body</ltx:table>",
  beforeDigest => sub { DefMacroI('\@captype', undef, 'table'); },
  afterDigest => sub { RescueCaptionCounters('table', $_[1]); });

# Redefine since JHEP has no width argument
# (what width should be used?)
DefEnvironment('{floatingfigure}[]',
"<ltx:figure refnum='#refnum' frefnum='#frefnum' rrefnum='#rrefnum' xml:id='#id' float='#float' width='#width'>"
    . "#body"
    . "</ltx:figure>",
  beforeDigest => sub { DefMacroI('\@captype', undef, 'figure'); },
  afterDigest => sub { RescueCaptionCounters('figure', $_[1]); },
  properties => sub {
    (float => (ToString($_[1] || LookupValue('floatfltpos')) =~ /^(v|r)/ ? 'right' : 'left')); });

DefEnvironment('{floatingtable}[]',
"<ltx:table refnum='#refnum' frefnum='#frefnum' rrefnum='#rrefnum' xml:id='#id' float='#float' width='#width'>"
    . "#body"
    . "</ltx:table>",
  beforeDigest => sub { DefMacroI('\@captype', undef, 'table'); },
  afterDigest => sub { RescueCaptionCounters('table', $_[1]); },
  properties => sub {
    (float => (ToString($_[1] || LookupValue('floatfltpos')) =~ /^(v|r)/ ? 'right' : 'left')); });

#======================================================================
# Hyperrefing stuff

# \href{url}{text}
DefConstructor('\href Semiverbatim  Semiverbatim',
  "<ltx:ref href='#href'>#2</ltx:ref>",
  properties => sub { (href => CleanURL((LookupValue('BASE_URL') || '') . ToString($_[1]))); });

DefMacro('\JHEPspecialurl Semiverbatim', '');    # ???
DefMacro('\base Semiverbatim',           '');
DefMacro('\name Semiverbatim',           '');
#======================================================================
# Journal references (w/links to an online database)
DefMacro('\@spires{}', '\href{http://www-spires.slac.stanford.edu/spires/find/hep/www?j=#1}');

DefMacro('\apa{}{}{}', '\@spires{APASA\%2C#1\%2C#3}{{\it Acta Phys.\ Austriaca }{\bf #1} (#2) #3}');
DefMacro('\apas{}{}{}', '\@spires{APAUA\%2C#1\%2C#3}{{\it Acta Phys.\ Austriaca, Suppl.\ }{\bf #1} (#2) #3}');
DefMacro('\appol{}{}{}', '\@spires{APPOA\%2C#1\%2C#3}{{\it Acta Phys.\ Polon.\ }{\bf #1} (#2) #3}');
DefMacro('\advm{}{}{}',  '\@spires{ADMTA\%2C#1\%2C#3}{{\it Adv.\ Math.\ }{\bf #1} (#2) #3}');
DefMacro('\adnp{}{}{}',  '\@spires{ANUPB\%2C#1\%2C#3}{{\it Adv.\ Nucl.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\adp{}{}{}',   '\@spires{ADPHA\%2C#1\%2C#3}{{\it Adv.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\atmp{}{}{}', '\@spires{00203\%2C#1\%2C#3}{{\it Adv.\ Theor.\ Math.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\am{}{}{}', '\@spires{ANMAA\%2C#1\%2C#3}{{\it Ann.\ Math.\ }{\bf #1} (#2) #3}');
DefMacro('\ap{}{}{}', '\@spires{APNYA\%2C#1\%2C#3}{{\it Ann.\ Phys.\ (NY) }{\bf #1} (#2) #3}');
DefMacro('\araa{}{}{}', '\@spires{ARAAA\%2C#1\%2C#3}{{\it Ann.\ Rev.\ Astron.\ \& Astrophys.\ }{\bf #1} (#2) #3}');
DefMacro('\arnps{}{}{}', '\@spires{ARNUA\%2C#1\%2C#3}{{\it Ann.\ Rev.\ Nucl.\ Part.\ Sci.\ }{\bf #1} (#2) #3}');
DefMacro('\asas{}{}{}', '\@spires{AAEJA\%2C#1\%2C#3}{{\it Astron.\ Astrophys.\ }{\bf #1} (#2) #3}');
DefMacro('\asj{}{}{}',  '\@spires{ANJOA\%2C#1\%2C#3}{{\it Astron.\ J.\ }{\bf #1} (#2) #3}');
DefMacro('\app{}{}{}',  '\@spires{APHYE\%2C#1\%2C#3}{{\it Astropart.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\apj{}{}{}',  '\@spires{ASJOA\%2C#1\%2C#3}{{\it Astrophys.\ J. }{\bf #1} (#2) #3}');
DefMacro('\baas{}{}{}', '\@spires{AASBA\%2C#1\%2C#3}{{\it Bull.\ Am.\ Astron.\ Soc.\ }{\bf #1} (#2) #3}');
DefMacro('\bams{}{}{}', '\@spires{BAMOA\%2C#1\%2C#3}{{\it Bull.\ Am.\ Math.\ Soc.\ }{\bf #1} (#2) #3}');
DefMacro('\blms{}{}{}', '\@spires{LMSBB\%2C#1\%2C#3}{{\it Bull.\ London Math.\ Soc.\ }{\bf #1} (#2) #3}');
DefMacro('\cjm{}{}{}', '\@spires{CJMAA\%2C#1\%2C#3}{{\it Can.\ J.\ Math.\ }{\bf #1} (#2) #3}');
DefMacro('\cqg{}{}{}', '\@spires{CQGRD\%2C#1\%2C#3}{{\it Class.\ and Quant.\ Grav.\ }{\bf #1} (#2) #3}');
DefMacro('\cmp{}{}{}', '\@spires{CMPHA\%2C#1\%2C#3}{{\it Commun.\ Math.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\ctp{}{}{}', '\@spires{CTPMD\%2C#1\%2C#3}{{\it Commun.\ Theor.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\cag{}{}{}', '\@spires{00142\%2C#1\%2C#3}{{\it Commun.\ Anal.\ Geom.\ }{\bf #1} (#2) #3}');
DefMacro('\cpam{}{}{}', '\@spires{CPAMA\%2C#1\%2C#3}{{\it Commun.\ Pure Appl.\ Math.\ }{\bf #1} (#2) #3}');
DefMacro('\cpc{}{}{}', '\@spires{CPHCB\%2C#1\%2C#3}{{\it Comput.\ Phys.\ Commun.\ }{\bf #1} (#2) #3}');
DefMacro('\dmj{}{}{}',  '\@spires{DUMJA\%2C#1\%2C#3}{{\it Duke Math.\ J. }{\bf #1} (#2) #3}');
DefMacro('\epjc{}{}{}', '\@spires{EPHJA\%2CC#1\%2C#3}{{\it Eur.\ Phys.\ J. }{\bf C #1} (#2) #3}');
DefMacro('\epjd{}{}{}', '\@spires{EPHJD\%2CC#1\%2C#3}{{\it Eur.\ Phys.\ J. Direct.\ }{\bf C #1} (#2) #3}');
DefMacro('\epl{}{}{}',  '\@spires{EULEE\%2C#1\%2C#3}{{\it Europhys.\ Lett. }{\bf #1} (#2) #3}');
DefMacro('\forp{}{}{}', '\@spires{FPYKA\%2C#1\%2C#3}{{\it Fortschr.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\faa{}{}{}', '\@spires{FAAPB\%2C#1\%2C#3}{{\it Funct.\ Anal.\ Appl.\ }{\bf #1} (#2) #3}');
DefMacro('\grg{}{}{}', '\@spires{GRGVA\%2C#1\%2C#3}{{\it Gen.\ Rel.\ Grav.\ }{\bf #1} (#2) #3}');
DefMacro('\hpa{}{}{}', '\@spires{HPACA\%2C#1\%2C#3}{{\it Helv.\ Phys.\ Acta }{\bf #1} (#2) #3}');
DefMacro('\ijmpa{}{}{}', '\@spires{IMPAE\%2CA#1\%2C#3}{{\it Int.\ J.\ Mod.\ Phys.\ }{\bf A #1} (#2) #3}');
DefMacro('\ijmpb{}{}{}', '\@spires{IMPAE\%2CB#1\%2C#3}{{\it Int.\ J.\ Mod.\ Phys.\ }{\bf B #1} (#2) #3}');
DefMacro('\ijmpc{}{}{}', '\@spires{IMPAE\%2CC#1\%2C#3}{{\it Int.\ J.\ Mod.\ Phys.\ }{\bf C #1} (#2) #3}');
DefMacro('\ijmpd{}{}{}', '\@spires{IMPAE\%2CD#1\%2C#3}{{\it Int.\ J.\ Mod.\ Phys.\ }{\bf D #1} (#2) #3}');
DefMacro('\ijtp{}{}{}', '\@spires{IJTPB\%2CB#1\%2C#3}{{\it Int.\ J.\ Theor.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\invm{}{}{}', '\@spires{INVMB\%2C#1\%2C#3}{{\it Invent.\ Math.\ }{\bf #1} (#2) #3}');
DefMacro('\jag{}{}{}',  '\@spires{00124\%2C#1\%2C#3}{{\it J.\ Alg.\ Geom.\ }{\bf #1} (#2) #3}');
DefMacro('\jams{}{}{}', '\@spires{00052\%2C#1\%2C#3}{{\it J.\ Am.\ Math.\ Soc.\ }{\bf #1} (#2) #3}');
DefMacro('\jap{}{}{}', '\@spires{JAPIA\%2C#1\%2C#3}{{\it J.\ Appl.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\jdg{}{}{}', '\@spires{JDGEA\%2C#1\%2C#3}{{\it J.\ Diff.\ Geom.\ }{\bf #1} (#2) #3}');
DefMacro('\jgp{}{}{}', '\@spires{JGPHE\%2C#1\%2C#3}{{\it J.\ Geom.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\jhep{}{}{}', '\href{http://jhep.sissa.it/stdsearch?paper=#1\%28#2\%29#3}{{\it J. High Energy Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\jmp{}{}{}',  '\@spires{JMAPA\%2C#1\%2C#3}{{\it J.\ Math.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\joth{}{}{}', '\@spires{JOTHE\%2C#1\%2C#3}{{\it J.\ Operator Theory }{\bf #1} (#2) #3}');
DefMacro('\jpha{}{}{}', '\@spires{JPAGB\%2CA#1\%2C#3}{{\it J. Phys.\ }{\bf A #1} (#2) #3}');
DefMacro('\jphc{}{}{}', '\@spires{JPAGB\%2CC#1\%2C#3}{{\it J. Phys.\ }{\bf C #1} (#2) #3}');
DefMacro('\jphg{}{}{}', '\@spires{JPAGB\%2CG#1\%2C#3}{{\it J. Phys.\ }{\bf G #1} (#2) #3}');
DefMacro('\lmp{}{}{}', '\@spires{LMPHD\%2CA#1\%2C#3}{{\it Lett.\ Math.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\ncl{}{}{}', '\@spires{NCLTA\%2C#1\%2C#3}{{\it Lett.\ Nuovo Cim.\ }{\bf #1} (#2) #3}');
DefMacro('\matan{}{}{}', '\@spires{MAANA\%2CA#1\%2C#3}{{\it Math.\ Ann.\ }{\bf #1} (#2) #3}');
DefMacro('\mussr{}{}{}', '\@spires{MUSIA\%2CA#1\%2C#3}{{\it Math.\ USSR Izv.\ }{\bf #1} (#2) #3}');
DefMacro('\mams{}{}{}', '\@spires{MAMCA\%2CA#1\%2C#3}{{\it Mem.\ Am.\ Math.\ Soc.\ }{\bf #1} (#2) #3}');
DefMacro('\mpla{}{}{}', '\@spires{MPLAE\%2CA#1\%2C#3}{{\it Mod.\ Phys.\ Lett.\ }{\bf A #1} (#2) #3}');
DefMacro('\mplb{}{}{}', '\@spires{MPLAE\%2CB#1\%2C#3}{{\it Mod.\ Phys.\ Lett.\ }{\bf B #1} (#2) #3}');
DefMacro('\nature{}{}{}', '\@spires{NATUA\%2C#1\%2C#3}{{\it Nature }{\bf #1} (#2) #3}');
DefMacro('\nim{}{}{}', '\@spires{NUIMA\%2C#1\%2C#3}{{\it Nucl.\ Instrum.\ Meth.\ }{\bf #1} (#2) #3}');
DefMacro('\npa{}{}{}', '\@spires{NUPHA\%2CA#1\%2C#3}{{\it Nucl.\ Phys.\ }{\bf A #1} (#2) #3}');
DefMacro('\npb{}{}{}', '\@spires{NUPHA\%2CB#1\%2C#3}{{\it Nucl.\ Phys.\ }{\bf B #1} (#2) #3}');
DefMacro('\npps{}{}{}', '\@spires{NUPHZ\%2C#1\%2C#3}{{\it Nucl.\ Phys.\ }{\bf #1} {\it(Proc.\ Suppl.)} (#2) #3}');
DefMacro('\nc{}{}{}',   '\@spires{NUCIA\%2C#1\%2C#3}{{\it Nuovo Cim.\ }{\bf #1} (#2) #3}');
DefMacro('\ncs{}{}{}',  '\@spires{NUCUA\%2C#1\%2C#3}{{\it Nuovo Cim.\ Suppl.\ }{\bf #1} (#2) #3}');
DefMacro('\pan{}{}{}',  '\@spires{PANUE\%2C#1\%2C#3}{{\it Phys.\ Atom.\ Nucl.\ }{\bf #1} (#2) #3}');
DefMacro('\pla{}{}{}',  '\@spires{PHLTA\%2CA#1\%2C#3}{{\it Phys.\ Lett.\ }{\bf A #1} (#2) #3}');
DefMacro('\plb{}{}{}',  '\@spires{PHLTA\%2CB#1\%2C#3}{{\it Phys.\ Lett.\ }{\bf B #1} (#2) #3}');
DefMacro('\pr{}{}{}',   '\@spires{PHRVA\%2C#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf #1} (#2) #3}');
DefMacro('\pra{}{}{}',  '\@spires{PHRVA\%2CA#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf A #1} (#2) #3}');
DefMacro('\prb{}{}{}',  '\@spires{PHRVA\%2CB#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf B #1} (#2) #3}');
DefMacro('\prc{}{}{}',  '\@spires{PHRVA\%2CC#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf C #1} (#2) #3}');
DefMacro('\prd{}{}{}',  '\@spires{PHRVA\%2CD#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf D #1} (#2) #3}');
DefMacro('\pre{}{}{}',  '\@spires{PHRVA\%2CE#1\%2C#3}{{\it Phys.\ Rev.\ }{\bf E #1} (#2) #3}');
DefMacro('\prep{}{}{}', '\@spires{PRPLC\%2C#1\%2C#3}{{\it Phys.\ Rept.\ }{\bf #1} (#2) #3}');
DefMacro('\prl{}{}{}',  '\@spires{PRLTA\%2C#1\%2C#3}{{\it Phys.\ Rev.\ Lett.\ }{\bf #1} (#2) #3}');
DefMacro('\phys{}{}{}', '\@spires{PHYSA\%2CA#1\%2C#3}{{\it Physica }{\bf #1} (#2) #3}');
DefMacro('\plms{}{}{}', '\@spires{PHLTA\%2CB#1\%2C#3}{{\it Proc.\ London Math.\ Soc.\ }{\bf B #1} (#2) #3}');
DefMacro('\pnas{}{}{}', '\@spires{PNASA\%2C#1\%2C#3}{{\it Proc.\ Nat.\ Acad.\ Sci.\ }{\bf #1} (#2) #3}');
DefMacro('\ppnp{}{}{}', '\@spires{PPNPD\%2C#1\%2C#3}{{\it Prog.\ Part.\ Nucl.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\ptp{}{}{}', '\@spires{PTPKA\%2C#1\%2C#3}{{\it Prog.\ Theor.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\ptps{}{}{}', '\@spires{PTPSA\%2C#1\%2C#3}{{\it Prog.\ Theor.\ Phys.\ Suppl.\ }{\bf #1} (#2) #3}');
DefMacro('\rmp{}{}{}', '\@spires{RMPHA\%2C#1\%2C#3}{{\it Rev.\ Mod.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\sjnp{}{}{}', '\@spires{SJNCA\%2C#1\%2C#3}{{\it Sov.\ J.\ Nucl.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\sjpn{}{}{}', '\@spires{SJPNA\%2C#1\%2C#3}{{\it Sov.\ J.\ Part.\ Nucl.\ }{\bf #1} (#2) #3}');
DefMacro('\jetp{}{}{}', '\@spires{SPHJA\%2C#1\%2C#3}{{\it Sov.\ Phys.\ JETP\/ }{\bf #1} (#2) #3}');
DefMacro('\jetpl{}{}{}', '\@spires{JTPLA\%2C#1\%2C#3}{{\it Sov.\ Phys.\ JETP Lett.\ }{\bf #1} (#2) #3}');
DefMacro('\spu{}{}{}', '\@spires{SOPUA\%2C#1\%2C#3}{{\it Sov.\ Phys.\ Usp.\ }{\bf #1} (#2) #3}');
DefMacro('\tmf{}{}{}', '\@spires{TMFZA\%2C#1\%2C#3}{{\it Teor.\ Mat.\ Fiz.\ }{\bf #1} (#2) #3}');
DefMacro('\tmp{}{}{}', '\@spires{TMPHA\%2C#1\%2C#3}{{\it Theor.\ Math.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\ufn{}{}{}', '\@spires{UFNAA\%2C#1\%2C#3}{{\it Usp.\ Fiz.\ Nauk.\ }{\bf #1} (#2) #3}');
DefMacro('\ujp{}{}{}', '\@spires{00267\%2C#1\%2C#3}{{\it Ukr.\ J.\ Phys.\ }{\bf #1} (#2) #3}');
DefMacro('\yf{}{}{}',  '\@spires{YAFIA\%2C#1\%2C#3}{{\it Yad.\ Fiz.\ }{\bf #1} (#2) #3}');
DefMacro('\zpc{}{}{}', '\@spires{ZEPYA\%2CC#1\%2C#3}{{\it Z.\ Physik }{\bf C #1} (#2) #3}');
DefMacro('\zetf{}{}{}', '\@spires{ZETFA\%2C#1\%2C#3}{{\it Zh.\ Eksp.\ Teor.\ Fiz.\ }{\bf #1} (#2) #3}');

DefMacro('\newjournal{}{}{}{}{}', '\@spires{#2\%2C#3\%2C#5}{{\it #1 }{\bf #3} (#4) #5}}');

DefMacro('\ibid{}{}{}', '{\it ibid.\ }{\bf #1} (#2) #3');

DefMacro('\hepth{}',   '\href{http://xxx.lanl.gov/abs/hep-th/#1}{\tt hep-th/#1}');
DefMacro('\hepph{}',   '\href{http://xxx.lanl.gov/abs/hep-ph/#1}{\tt hep-ph/#1}');
DefMacro('\heplat{}',  '\href{http://xxx.lanl.gov/abs/hep-lat/#1}{\tt hep-lat/#1}');
DefMacro('\hepex{}',   '\href{http://xxx.lanl.gov/abs/hep-ex/#1}{\tt hep-ex/#1}');
DefMacro('\nuclth{}',  '\href{http://xxx.lanl.gov/abs/nucl-th/#1}{\tt nucl-th/#1}');
DefMacro('\nuclex{}',  '\href{http://xxx.lanl.gov/abs/nucl-ex/#1}{\tt nucl-ex/#1}');
DefMacro('\grqc{}',    '\href{http://xxx.lanl.gov/abs/gr-qc/#1}{\tt gr-qc/#1}');
DefMacro('\qalg{}',    '\href{http://xxx.lanl.gov/abs/q-alg/#1}{\tt q-alg/#1}');
DefMacro('\accphys{}', '\href{http://xxx.lanl.gov/abs/accphys/#1}{\tt accphys/#1}');
DefMacro('\alggeom{}', '\href{http://xxx.lanl.gov/abs/alg-geom/#1}{\tt alg-geom/#1}');
DefMacro('\astroph{}', '\href{http://xxx.lanl.gov/abs/astro-ph/#1}{\tt astro-ph/#1}');
DefMacro('\chaodyn{}', '\href{http://xxx.lanl.gov/abs/chao-dyn/#1}{\tt chao-dyn/#1}');
DefMacro('\condmat{}', '\href{http://xxx.lanl.gov/abs/cond-mat/#1}{\tt cond-mat/#1}');
DefMacro('\nlinsys{}', '\href{http://xxx.lanl.gov/abs/nlin-sys/#1}{\tt nlin-sys/#1}');
DefMacro('\quantph{}', '\href{http://xxx.lanl.gov/abs/quant-ph/#1}{\tt quant-ph/#1}');
DefMacro('\solvint{}', '\href{http://xxx.lanl.gov/abs/solv-int/#1}{\tt solv-int/#1}');
DefMacro('\suprcon{}', '\href{http://xxx.lanl.gov/abs/supr-con/#1}{\tt supr-con/#1}');
#DefMacro('\mathph{}','\href{http://xxx.lanl.gov/abs/math-ph/#1}{\tt math-ph/#1}');
#DefMacro('\physics{}','\href{http://xxx.lanl.gov/abs/physics/#1}{\tt physics/#1}');
DefMacro('\Math{}{}', '\href{http://xxx.lanl.gov/abs/math.#1/#2}{\tt math.#1/#2}');

#======================================================================

RawTeX(<<'EoTeX');
\newif\if@preprint\@preprinttrue                % DEFAULT IS PREPRINT!
\newif\if@draft   \@draftfalse                  % DEFAULT IS NOT DRAFT
\newif\if@hyper   \@hypertrue                   % DEFAULT IS HYPER
\newif\if@proc    \@procfalse                   % DEFAULT IS NOT PROC

%\newif\if@title\@titlefalse                    %
\newif\if@author\@authorfalse                   %
\newif\if@abstract\@abstractfalse               % FOR FRONTMATTER DECLARATIONS
\newif\if@keywords\@keywordsfalse               %
\newif\if@todotoc\@todotocfalse                 %
\newif\if@rece\@recefalse                       %
\newif\if@revi\@revifalse                       %
\newif\if@acce\@accefalse                       %
\newif\if@Jcopy\@Jcopyfalse                     %
\newif\if@JHEP\@JHEPfalse                       %
\newif\if@conf\@conffalse                       %
\newif\if@Jspecialurl\@Jspecialurlfalse

\newif\if@speaker\@speakerfalse
\newif\if@dblspeak\@dblspeakfalse

\newif\if@twothms\@twothmsfalse
\newtoks\outputpretest
EoTeX

DefMacro('\contentsname',   'Contents');
DefMacro('\listfigurename', 'List of figures');
DefMacro('\listtablename',  'List of tables');
DefMacro('\refname',        'References');
DefMacro('\indexname',      'Index');
DefMacro('\figurename',     'Figure');
DefMacro('\tablename',      'Table');
DefMacro('\partname',       'Part');
DefMacro('\appendixname',   'Appendix');
DefMacro('\abstractname',   'Abstract:');
DefMacro('\keywordsname',   'Keywords:');
DefMacro('\receivedname',   'Received:');
DefMacro('\revisedname',    'Revised:');
DefMacro('\acceptedname',   'Accepted:');
DefMacro('\acknowlname',    'Acknowledgments');

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1;

__END__