# -*- mode: Perl -*-
# /=====================================================================\ #
# | iopart_support | #
# | 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;
RawTeX(<<'EOTeX');
\newif\ifletter\letterfalse
\newif\ifnumbysec\numbysecfalse
\newif\ifiopams\iopamsfalse
EOTeX
DefMacroI('\eqnobysec', undef, '\numbysectrue\@addtoreset{equation}{section}');
DefMacroI('\theequation', undef, '\ifnumbysec\arabic{section}.\arabic{equation}\else\arabic{equation}\fi');
#======================================================================
# Frontmatter
DefMacro('\title[]{}',
'\ifx.#1.\else\@add@frontmatter{ltx:toctitle}{#1}\fi'
. '\@add@frontmatter{ltx:title}{#2}');
Let('\paper', '\title');
DefMacro('\@articletype', '');
DefMacro('\article[]{}{}',
'\ifx.#1.\else\@add@frontmatter{ltx:toctitle}{#1}\fi'
. '\ifx.#2.\else\@add@frontmatter{ltx:classification}[scheme=type]{#2}\fi'
. '\@add@frontmatter{ltx:title}{#3}');
DefMacro('\letter{}', '\article[Letter to the Editor]{Letter to the Editor}{#1}\lettertrue');
DefMacro('\review[]{}', '\article[#1]{Review Article}{#2}');
DefMacro('\topical[]{}', '\article[#1]{Topical Review}{#2}');
DefMacro('\comment[]{}', '\article[#1]{Comment}{#2}');
DefMacro('\rapid[]{}', '\article[#1]{Rapid Communication}{#2}');
DefMacro('\note[]{}', '\article[#1]{Note}{#2}');
DefMacro('\prelim[]{}', '\article[#1]{Preliminary Communication}{#2}');
DefConstructor('\@@@address{}', "^ <ltx:contact role='address'>#1</ltx:contact>", bounded => 1);
DefMacro('\address{}', '\@add@to@frontmatter{ltx:creator}{\@@@address{#1}}');
DefMacro('\ead Semiverbatim', '\@add@to@frontmatter{ltx:creator}{\@@@email{#1}}');
DefConstructor('\@@@email{}', "^ <ltx:contact role='email'>#1</ltx:contact>");
Let('\mailto', '\ead');
#DefMacro('\eads DigestedBody','#1');
DefMacro('\eads {}', '#1');
DefMacro('\pacno{}', '\@add@frontmatter{ltx:classification}[scheme=pacs]{#1}');
DefMacro('\pacs{}', '\@add@frontmatter{ltx:classification}[scheme=pacs]{#1}');
DefMacro('\ams{}', '\@add@frontmatter{ltx:classification}[scheme=ams]{#1}');
our @journals = ('Institute of Physics Publishing',
'J. Phys.\ A: Math.\ Gen.\ ',
'J. Phys.\ B: At.\ Mol.\ Opt.\ Phys.\ ',
'J. Phys.:\ Condens. Matter\ ',
'J. Phys.\ G: Nucl.\ Part.\ Phys.\ ',
'Inverse Problems\ ',
'Class. Quantum Grav.\ ',
'Network: Comput.\ Neural Syst.\ ',
'Nonlinearity\ ',
'J. Opt. B: Quantum Semiclass. Opt.\ ',
'Waves Random Media\ ',
'J. Opt. A: Pure Appl. Opt.\ ',
'Phys. Med. Biol.\ ',
'Modelling Simul.\ Mater.\ Sci.\ Eng.\ ',
'Plasma Phys. Control. Fusion\ ',
'Physiol. Meas.\ ',
'Combust. Theory Modelling\ ',
'High Perform.\ Polym.\ ',
'Public Understand. Sci.\ ',
'Rep.\ Prog.\ Phys.\ ',
'J.\ Phys.\ D: Appl.\ Phys.\ ',
'Supercond.\ Sci.\ Technol.\ ',
'Semicond.\ Sci.\ Technol.\ ',
'Nanotechnology\ ',
'Measur.\ Sci.\ Technol.\ ',
'Plasma.\ Sources\ Sci.\ Technol.\ ',
'Smart\ Mater.\ Struct.\ ',
'J.\ Micromech.\ Microeng.\ ',
'Distrib.\ Syst.\ Engng\ ',
'Bioimaging\ ',
'J.\ Radiol. Prot.\ ',
'Europ. J. Phys.\ ',
'J. Opt. A: Pure Appl. Opt.\ ',
'New. J. Phys.\ ');
DefMacro('\journal', 'Institute of Physics Publishing');
DefMacro('\submitted', '\submitto{\journal}');
DefMacro('\submitto{}', '\def\journal{#1}\@add@to@frontmatter{ltx:note}[role=submitted]{#1}');
DefPrimitive('\jl{}', sub {
if (my $j = $journals[ToString($_[1])]) {
DefMacroI('\journal', undef, Tokenize($j)); } });
#======================================================================
# Math
DefMath('\rmd', "\x{2146}", role => 'DIFFOP', meaning => 'differential-d');
DefMath('\rme', "\x{2147}", role => 'ID', meaning => 'exponential-e');
DefMath('\rmi', "\x{2148}", role => 'ID', meaning => 'imaginary-i');
Let('\e', '\rme');
DefPrimitiveI('\bcal', undef, '',
font => { family => 'caligraphic', series => 'bold', shape => 'upright',
forcebold => 1 });
DefPrimitiveI('\bi', undef, '',
font => { family => 'italic', series => 'bold', shape => 'upright',
forcebold => 1 });
DefMacro('\fl', Tokens()); # ?
DefMacro('\case{}{}', '{\textstyle\frac{#1}{#2}}');
DefMath('\Tr', '\mathrm{Tr}', role => 'OPFUNCTION', meaning => 'trace');
DefMath('\tr', '\mathrm{tr}', role => 'OPFUNCTION', meaning => 'trace');
DefMath('\Or', '\mathrm{O}', role => "OPFUNCTION", meaning => 'Big-O');
DefMath('\tdot Digested', "\x{2026}", operator_role => 'OVERACCENT');
DefMath('\lshad', "\x{27E6}", role => 'OPEN');
DefMath('\rshad', "\x{27E7}", role => 'CLOSE');
DefMacroI('\dsty', undef, '\displaystyle');
DefMacroI('\tsty', undef, '\textstyle');
DefMacroI('\ssty', undef, '\scriptstyle');
DefMacroI('\sssty', undef, '\scriptscriptstyle');
RawTeX('\def\pt(#1){({\it #1\/})}');
# Can't really handle \llap in any sensible way...
DefMacro('\lo', '\llap{${}#1{}$}');
DefMacro('\eql', '\llap{${}={}$}');
DefMacro('\lsim', '\llap{${}\sim{}$}');
DefMacro('\lsimeq', '\llap{${}\simeq{}$}');
DefMacro('\lequiv', '\llap{${}\equiv{}$}');
DefPrimitiveI('\opencircle', undef, "\x{25CB}");
DefPrimitiveI('\opensquare', undef, "\x{25A1}");
DefPrimitiveI('\opentriangle', undef, "\x{25B3}");
DefPrimitiveI('\opentriangledown', undef, "\x{25BD}");
DefPrimitiveI('\opendiamond', undef, "\x{25C6}");
DefPrimitiveI('\fullcircle', undef, "\x{25CF}");
DefPrimitiveI('\fullsquare', undef, "\x{25A0}");
DefMacroI('\dotted', undef, '\ensuremath{{\mathinner{\cdotp\cdotp\cdotp\cdotp\cdotp\cdotp}}}');
DefMacroI('\dashed', undef, '{\protect\mbox{-\; -\; -\; -}}');
DefMacroI('\broken', undef, '{\protect\mbox{-- -- --}}');
DefMacroI('\longbroken', undef, '{\protect\mbox{--- --- ---}}');
DefMacroI('\chain', undef, '{\protect\mbox{--- $\cdot$ ---}}');
DefMacroI('\dashddot', undef, '{\protect\mbox{--- $\cdot$ $\cdot$ ---}}');
DefMacroI('\full', undef, '{\protect\mbox{------}}');
DefEnvironment('{numparts}',
"<ltx:equationgroup refnum='#refnum' frefnum='#frefnum' rrefnum='#rrefnum' xml:id='#id'>"
. "#body"
. "</ltx:equationgroup>",
afterDigestBegin => sub {
my ($stomach, $whatsit) = @_;
my %eqn = RefStepCounter('equation');
AssignValue(SAVED_EQUATION_NUMBER => LookupValue('\c@equation'));
$whatsit->setProperties(%eqn);
ResetCounter('equation');
DefMacro('\theequation', UnTeX($eqn{refnum}) . '\alph{equation}');
DefMacro('\theequation@ID', UnTeX($eqn{id}) . '.\@equation@ID');
},
afterDigest => sub {
AssignValue('\c@equation', LookupValue('SAVED_EQUATION_NUMBER'), 'global'); });
Let('\pcal', '\cal');
Let('\pmit', '\mathnormal');
# \eqnalign is much like eqnarray, but with 2 columns
# \eqnalignno is also, but with a 3rd column which contains the number!
# Let's see if this works at all...
DefMacro('\eqnalign{}',
'\@eqnarray@bindings\@@eqnarray'
. '\@equationgroup@number\@start@alignment'
. '#1'
. '\@finish@alignment\end@eqnarray');
DefMacro('\eqnalignno{}',
'\@eqnarray@bindings\@@eqnarray'
. '\@equationgroup@number\@start@alignment'
. '#1'
. '\@finish@alignment\end@eqnarray');
#======================================================================
DefMacro('\eref{}', '(\ref{#1})');
DefMacro('\sref{}', 'section~\ref{#1}');
DefMacro('\fref{}', 'figure~\ref{#1}');
DefMacro('\tref{}', 'table~\ref{#1}');
DefMacro('\Eref{}', 'Equation (\ref{#1})');
DefMacro('\Sref{}', 'Section~\ref{#1}');
DefMacro('\Fref{}', 'Figure~\ref{#1}');
DefMacro('\Tref{}', 'Table~\ref{#1}');
#======================================================================
# Tables & Figures.
# This is liable to cause numbering clashes ???
DefMacroI('\noappendix', undef,
'\setcounter{figure}{0}\setcounter{table}{0}'
. '\def\thetable{\arabic{table}}\def\thefigure{\arabic{figure}}');
DefMacroI('\Tables', undef, '\section*{Tables and table captions}\noappendix');
DefMacroI('\Figures', undef, '\section*{Figure captions}\noappendix');
DefMacro('\Figure{}', '\begin{figure}\caption{#1}\end{figure}');
DefMacro('\Table{}', '\begin{table}\caption{#1}\begin{tabular}{@{}l*{15}{l}}');
DefMacroI('\endTable', undef, '\end{tabular}\end{table}');
Let('\endtab', '\endTable');
DefMacro('\fulltable{}', '\begin{table}\caption{#1}\begin{tabular}{@{}l*{15}{l}}');
DefMacroI('\endfulltable', undef, '\end{tabular}\end{table}');
DefMacroI('\lineup', undef, '\def\0{\hbox{\phantom{\footnotesize\rm 0}}}\def\m{\hbox{\phantom{-}}}');
DefMacroI('\boldarrayrulewidth', undef, '1pt');
Let('\bhline', '\hline');
DefMacroI('\br', undef, '\hline');
DefMacroI('\mr', undef, '\hline');
DefMacro('\centre{}{}', '\multispan{#1}{\hfill #2\hfill}');
DefMacro('\crule{}{}', '\multispan{#1}{\hrulefill}');
DefMacro('\fcrule{}', '\multispan{#1}{\hrulefill}'); # ?
#?
Let('\ms', '\,');
Let('\bs', '\:');
Let('\ns', '\!');
Let('\es', '\:');
Let('\psemicolon', '\;');
DefMacro('\mat{}', '\underline{\underline{#1}}');
#======================================================================
# Bibliography
DefMacro('\Bibliography{}', '\section*{References}\numrefs{#1}');
DefMacro('\References', '\section*{References}\refs');
DefMacro('\numrefs{}', '\begin{thebibliography}{#1}');
DefMacro('\endnumrefs', '\end{thebibliography}');
Let('\endbib', '\endnumrefs');
DefMacro('\thereferences', '\begin{thebibliography}{}'); # ???
DefMacro('\endthereferences', '\end{thebibliography}');
DefMacro('\harvard', '\begin{thebibliography}{}'); # ???
DefMacro('\endharvard', '\end{thebibliography}');
DefMacro('\refs', '\begin{thebibliography}{}'); # ???
DefMacro('\endrefs', '\end{thebibliography}');
#======================================================================
DefConstructor('\ack', "<ltx:acknowledgements>"); # name?
DefConstructor('\ackn', "<ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);
#======================================================================
# Abbreviations
DefMacro('\etal', '\textit{et al\/}');
DefMacro('\dash', '-----');
DefMacroI('\CQG', undef, '\textit{Class. Quantum Grav.}');
DefMacroI('\CTM', undef, '\textit{Combust. Theory Modelling\/}');
DefMacroI('\DSE', undef, '\textit{Distrib. Syst. Engng\/}');
DefMacroI('\EJP', undef, '\textit{Eur. J. Phys.}');
DefMacroI('\HPP', undef, '\textit{High Perform. Polym.}');
DefMacroI('\IP', undef, '\textit{Inverse Problems\/}');
DefMacroI('\JHM', undef, '\textit{J. Hard Mater.}');
DefMacroI('\JO', undef, '\textit{J. Opt.}');
DefMacroI('\JOA', undef, '\textit{J. Opt. A: Pure Appl. Opt.}');
DefMacroI('\JOB', undef, '\textit{J. Opt. B: Quantum Semiclass. Opt.}');
DefMacroI('\JPA', undef, '\textit{J. Phys. A: Math. Gen.}');
DefMacroI('\JPB', undef, '\textit{J. Phys. B: At. Mol. Phys.}');
DefMacroI('\jpb', undef, '\textit{J. Phys. B: At. Mol. Opt. Phys.}');
DefMacroI('\JPC', undef, '\textit{J. Phys. C: Solid State Phys.}');
DefMacroI('\JPCM', undef, '\textit{J. Phys.: Condens. Matter\/}');
DefMacroI('\JPD', undef, '\textit{J. Phys. D: Appl. Phys.}');
DefMacroI('\JPE', undef, '\textit{J. Phys. E: Sci. Instrum.}');
DefMacroI('\JPF', undef, '\textit{J. Phys. F: Met. Phys.}');
DefMacroI('\JPG', undef, '\textit{J. Phys. G: Nucl. Phys.}');
DefMacroI('\jpg', undef, '\textit{J. Phys. G: Nucl. Part. Phys.}');
DefMacroI('\MSMSE', undef, '\textit{Modelling Simulation Mater. Sci. Eng.}');
DefMacroI('\MST', undef, '\textit{Meas. Sci. Technol.}');
DefMacroI('\NET', undef, '\textit{Network: Comput. Neural Syst.}');
DefMacroI('\NJP', undef, '\textit{New J. Phys.}');
DefMacroI('\NL', undef, '\textit{Nonlinearity\/}');
DefMacroI('\NT', undef, '\textit{Nanotechnology}');
DefMacroI('\PAO', undef, '\textit{Pure Appl. Optics\/}');
DefMacroI('\PM', undef, '\textit{Physiol. Meas.}');
DefMacroI('\PMB', undef, '\textit{Phys. Med. Biol.}');
DefMacroI('\PPCF', undef, '\textit{Plasma Phys. Control. Fusion\/}');
DefMacroI('\PSST', undef, '\textit{Plasma Sources Sci. Technol.}');
DefMacroI('\PUS', undef, '\textit{Public Understand. Sci.}');
DefMacroI('\QO', undef, '\textit{Quantum Opt.}');
DefMacroI('\QSO', undef, '\textit{Quantum Semiclass. Opt.}');
DefMacroI('\RPP', undef, '\textit{Rep. Prog. Phys.}');
DefMacroI('\SLC', undef, '\textit{Sov. Lightwave Commun.}');
DefMacroI('\SST', undef, '\textit{Semicond. Sci. Technol.}');
DefMacroI('\SUST', undef, '\textit{Supercond. Sci. Technol.}');
DefMacroI('\WRM', undef, '\textit{Waves Random Media\/}');
DefMacroI('\JMM', undef, '\textit{J. of Michromech. and Microeng.\/}');
DefMacroI('\AC', undef, '\textit{Acta Crystallogr.}');
DefMacroI('\AM', undef, '\textit{Acta Metall.}');
DefMacroI('\AP', undef, '\textit{Ann. Phys., Lpz.}');
DefMacroI('\APNY', undef, '\textit{Ann. Phys., NY\/}');
DefMacroI('\APP', undef, '\textit{Ann. Phys., Paris\/}');
DefMacroI('\CJP', undef, '\textit{Can. J. Phys.}');
DefMacroI('\JAP', undef, '\textit{J. Appl. Phys.}');
DefMacroI('\JCP', undef, '\textit{J. Chem. Phys.}');
DefMacroI('\JJAP', undef, '\textit{Japan. J. Appl. Phys.}');
DefMacroI('\JP', undef, '\textit{J. Physique\/}');
DefMacroI('\JPhCh', undef, '\textit{J. Phys. Chem.}');
DefMacroI('\JMMM', undef, '\textit{J. Magn. Magn. Mater.}');
DefMacroI('\JMP', undef, '\textit{J. Math. Phys.}');
DefMacroI('\JOSA', undef, '\textit{J. Opt. Soc. Am.}');
DefMacroI('\JPSJ', undef, '\textit{J. Phys. Soc. Japan\/}');
DefMacroI('\JQSRT', undef, '\textit{J. Quant. Spectrosc. Radiat. Transfer\/}');
DefMacroI('\NC', undef, '\textit{Nuovo Cimento\/}');
DefMacroI('\NIM', undef, '\textit{Nucl. Instrum. Methods\/}');
DefMacroI('\NP', undef, '\textit{Nucl. Phys.}');
DefMacroI('\PL', undef, '\textit{Phys. Lett.}');
DefMacroI('\PR', undef, '\textit{Phys. Rev.}');
DefMacroI('\PRL', undef, '\textit{Phys. Rev. Lett.}');
DefMacroI('\PRS', undef, '\textit{Proc. R. Soc.}');
DefMacroI('\PS', undef, '\textit{Phys. Scr.}');
DefMacroI('\PSS', undef, '\textit{Phys. Status Solidi\/}');
DefMacroI('\PTRS', undef, '\textit{Phil. Trans. R. Soc.}');
DefMacroI('\RMP', undef, '\textit{Rev. Mod. Phys.}');
DefMacroI('\RSI', undef, '\textit{Rev. Sci. Instrum.}');
DefMacroI('\SSC', undef, '\textit{Solid State Commun.}');
DefMacroI('\ZP', undef, '\textit{ Z. Phys.}');
DefMacroI('\JNE', undef, '\textit{J. Neural Eng.}');
DefMacroI('\PB', undef, '\textit{Phys. Biol.}');
DefMacroI('\SMS', undef, '\textit{Smart Mater. Struct.}');
#======================================================================
# Mystery items...
DefMacroI('\tqs', undef, '\hspace*{25pt}');
DefMacroI('\nosections', undef, Tokens()); # ?
DefMacroI('\indented', undef, '\itemize');
DefMacroI('\endindented', undef, '\enditemize');
DefMacroI('\varindent', undef, '\itemize');
DefMacroI('\endvarindent', undef, '\enditemize');
DefMacroI('\nonum', undef, '\par'); # ?
#======================================================================
1;