1# -*- mode: Perl -*-
2# /=====================================================================\ #
3# |  aas_support.sty.ltxml                                              | #
4# | Support for various AAS styles/classes for LaTeXML                  | #
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# | Thanks to the arXMLiv group for initial implementation              | #
11# |    http://arxmliv.kwarc.info/                                       | #
12# | Released to the Public Domain                                       | #
13# |---------------------------------------------------------------------| #
14# | Bruce Miller <bruce.miller@nist.gov>                        #_#     | #
15# | http://dlmf.nist.gov/LaTeXML/                              (o o)    | #
16# \=========================================================ooo==U==ooo=/ #
17package LaTeXML::Package::Pool;
18use strict;
19use warnings;
20use LaTeXML::Package;
21
22#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23# AAS : American Astronomical Society
24# Derived from aasguide
25# I have the suspicion that AAS style is strongly related to RevTeX,
26# but I don't see it ever made explicit.
27#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28RequirePackage('aas_macros');
29
30### New as of august 2015:
31RequirePackage('url');
32RequirePackage('longtable');
33RequirePackage('xcolor');
34RequirePackage('hyperref');
35RequirePackage('array');
36RequirePackage('lineno');
37RequirePackage('ulem');
38#======================================================================
39# 2.1.3 Editorial Information
40
41DefMacro('\received{}', '\@add@frontmatter{ltx:date}[role=received,name=Received]{#1}');
42DefMacro('\revised{}',  '\@add@frontmatter{ltx:date}[role=revised,name=Revised]{#1}');
43DefMacro('\accepted{}', '\@add@frontmatter{ltx:date}[role=accepted,name=Accepted]{#1}');
44
45# Could add more metadata..
46DefMacro('\journalid{}{}', '');
47DefMacro('\articleid{}{}', '');
48DefMacro('\paperid{}',     '');
49DefMacro('\msid{}',        '');    # Manuscript id.
50DefMacro('\added{}',       '');
51DefMacro('\replaced{}',    '');
52DefMacro('\deleted{}',     '');
53DefMacro('\explain{}',     '');
54DefMacro('\edit{}{}',      '');
55
56#\ccc{code}
57DefMacro('\ccc{}', '');            # Ignorable?
58#\cpright{type}{year}   Should be recorded somehow?
59# type is AAS, ASP, PD, none
60DefMacro('\cpright{}{}', '\@add@frontmatter{ltx:note}[role=copyright]{\copyright #2: #1}');
61
62# Editorial additions?
63DefMacro('\journal{}',    '');
64DefMacro('\volume{}',     '');
65DefMacro('\issue{}',      '');
66DefMacro('\SGMLbi{}',     '#1');
67DefMacro('\SGMLbsc{}',    '#1');
68DefMacro('\SGMLclc{}',    '#1');
69DefMacro('\SGMLentity{}', '#1');    # Actually should produce &#1; !!!
70DefMacro('\SGML{}',       '');
71
72#======================================================================
73# 2.1.4 Short Comment
74
75DefMacro('\slugcomment{}', '\@add@frontmatter{ltx:note}[role=slugcomment]{#1}');
76
77#======================================================================
78# 2.1.5 Running Heads
79
80DefMacro('\shorttitle{}',   '\@add@frontmatter{ltx:toctitle}{#1}');
81DefMacro('\shortauthors{}', '');                                      # not useful?
82# Meant to be used redundantly with an \author macro, so just register the correspondence here
83DefMacro('\correspondingauthor{}', '\lx@contact{correspondent}{#1}');
84
85# I had thought that \lefthead,\righthead were obsolete forms of \shorttitle,\shortauthors,
86# but who knows which goes on which side.... anyway, they get misused too.
87# better have them just disappear.
88DefMacro('\lefthead{}',  '');    # Obsolete form
89DefMacro('\righthead{}', '');    # Obsolete form
90
91#======================================================================
92# 2.2 Starting the Main Body
93# normal LaTeX
94
95#======================================================================
96# 2.3 Title and Author Information
97AssignMapping('DOCUMENT_CLASSES', ltx_authors_multiline => 1);
98DefConstructor('\@@personname[]{}', "<ltx:personname>" .
99    "?#1(<ltx:ref href='https://orcid.org/#1' class='orcid'>#2</ltx:ref>)(#2)" .
100    "</ltx:personname>)");
101DefMacro('\author[]{}',
102  '\@add@frontmatter{ltx:creator}[role=author]{\@@personname[#1]{#2}}');
103
104DefConstructor('\@@@affiliation{}', "^ <ltx:contact role='affiliation'>#1</ltx:contact>");
105DefMacro('\affiliation{}', '\@add@to@frontmatter{ltx:creator}{\@@@affiliation{#1}}');
106DefMacro('\affil',         '\affiliation');
107DefConstructor('\@@@altaffil{}', "^ <ltx:contact role='affiliation'>#1</ltx:contact>");
108DefMacro('\altaffiliation{}', '\@add@to@frontmatter{ltx:creator}{\@@@altaffil{#1}}');
109DefConstructor('\@@@authoraddr{}', "^ <ltx:contact role='address'>#1</ltx:contact>");
110DefMacro('\authoraddr{}', '\@add@to@frontmatter{ltx:creator}{\@@@authoraddr{#1}}');
111
112DefConstructor('\@@@email{}', "^ <ltx:contact role='email'>#1</ltx:contact>");
113DefMacro('\email{}', '\@add@to@frontmatter{ltx:creator}{\@@@email{#1}}');
114# Redefine to straight email address after document begin.
115AddToMacro(T_CS('\@startsection@hook'), TokenizeInternal('\let\email\@@email'));
116
117DefPrimitive('\and', undef);
118DefMacro('\authoremail', '\email');    # Obsolete form
119
120# NOTE: the the footnote machinery in LaTeX.pool will connect these.
121# Ideally, we'd like these comma separated!
122DefMacro('\altaffilmark{}', sub {
123    my ($gullet, $marks) = @_;
124    map { (T_CS('\@altaffilmark'), T_BEGIN, @$_, T_END) } SplitTokens($marks, T_OTHER(',')); });
125DefConstructor('\@altaffilmark{}',
126  "<ltx:note role='affiliationmark' mark='#1'/> ");
127DefConstructor('\altaffiltext{}{}',
128  "<ltx:note role='affiliationtext' mark='#1'>#2</ltx:note>");
129
130DefMacro('\software{}',      '\@add@frontmatter{ltx:note}[role=software]{#1}');
131DefMacro('\submitjournal{}', '\@add@frontmatter{ltx:note}[role=journal]{#1}');
132# Alas \doi is not frontmatter.
133DefConstructor('\doi{}',             '<ltx:ref href="https:/doi.org/#1">#1</ltx:ref>');
134DefConstructor('\@@@collaborator{}', "<ltx:note role='collaborator'>#1</ltx:note>");
135DefMacro('\collaboration{}{}', '\@add@to@frontmatter{ltx:creator}{\@@@collaborator{#2}}');
136DefMacro('\nocollaboration{}', '');
137#======================================================================
138# 2.4 Abstract
139# normal LaTeX
140
141#======================================================================
142# 2.5 Keywords
143
144DefMacro('\keywords{}', '\@add@frontmatter{ltx:keywords}[name={\@ifundefined{keywordsname}{}{\keywordsname}}]{#1}');
145Let('\subjectheadings', '\keywords');
146
147#======================================================================
148# 2.6 Comments to Editors
149
150# Perhaps this should actually disappear?
151# DefConstructor('\notetoeditor{}',"<ltx:note role='toeditor'>#1</ltx:note>");
152DefMacro('\notetoeditor{}', '');
153
154NewCounter('editornote');
155DefMacroI('\theeditornote', undef, 'E\arabic{editornote}');
156#======================================================================
157# 2.7 Sections
158# normal LaTeX
159
160# Except that they apparently allow subsubsubsections! Ugh!
161#======================================================================
162# 2.8 Figure and Table Placement
163
164# These tell where the table/figure labeled with \label{key} ought to appear;
165# the assumption is the tables/figures are at the end of the document.
166# Best would be if we moved them to there the \placeXXX is!
167# \placetable{key}
168# \placefigure{key}
169# For now, we ignore them, however.
170DefMacro('\placetable{}',  '');
171DefMacro('\placefigure{}', '');
172DefMacro('\placeplate{}',  '');
173
174NewCounter('plate');
175DefMacroI('\platename', undef, 'Plate');
176
177# Is there any kind of "list of plates" ? Then we'd need @inlists
178DefEnvironment('{plate}[]',
179  "<ltx:float xml:id='#id' inlist='#inlist' ?#1(placement='#1') class='ltx_float_plate'>"
180    . "#tags"
181    . "#body"
182    . "</ltx:float>",
183  beforeDigest => sub { DefMacroI('\@captype', undef, 'plate'); },
184  afterDigest  => sub { RescueCaptionCounters('plate', $_[1]); });
185
186DefEnvironment('{plate*}[]',
187  "<ltx:float xml:id='#id' inlist='#inlist' ?#1(placement='#1') class='ltx_float_plate'>"
188    . "#tags"
189    . "#body"
190    . "</ltx:float>",
191  beforeDigest => sub { DefMacroI('\@captype', undef, 'plate'); },
192  afterDigest  => sub { RescueCaptionCounters('plate', $_[1]); });
193
194DefMacro('\platewidth{Dimension}', '');                    # Ignorable?
195DefMacro('\platenum{}',            '\def\theplate{#1}');
196
197DefMacro('\gridline{}', '');
198DefMacro('\fig Semiverbatim {Dimension}{}',
199  '\begin{figure}\caption{#3}\includegraphics[width=#2]{#1}\end{figure}');
200Let('\leftfig',  '\fig');
201Let('\rightfig', '\fig');
202Let('\boxedfig', '\fig');
203DefMacro('\rotatefig {Number} Semiverbatim {Dimension}{}',
204  '\begin{figure}\caption{#4}\includegraphics[width=#3,angle=#1]{#2}\end{figure}');
205
206DefEnvironment('{interactive}{}{}', '#body');
207
208#======================================================================
209# 2.9 Acknowledgements
210
211# acts like \section{Acknowledgements}, rather than container.
212Tag("ltx:acknowledgements", autoClose => 1);
213DefConstructor('\acknowledgements', "<ltx:acknowledgements>");
214Let('\acknowledgments', '\acknowledgements');
215
216#======================================================================
217# 2.10 Facilities
218
219# Ultimately, this would get some more explicit semantic markup, but..
220# \facility{facilityID}
221DefConstructor('\facility{}', "<ltx:text class='ltx_ast_facility'>#1</ltx:text>");
222DefMacro('\facilities{}', '\@add@frontmatter{ltx:note}[role=facilities]{#1}');
223
224#======================================================================
225# 2.11 Appendices
226# almost normal LaTeX
227DefMacro('\appendix', '\@appendix');
228DefPrimitive('\@appendix', sub {
229    startAppendices('section');
230    NewCounter('equation', 'section', idprefix => 'E');
231    DefMacro('\theequation', '\thesection\arabic{equation}', scope => 'global'); });
232
233#======================================================================
234# 2.12 Equations
235# mostly normal LaTeX
236
237# Basically, {mathletters} is a copy of AMSMath's {subequations}... Isn't it?
238DefMacro('\mathletters',    '\lx@equationgroup@subnumbering@begin');
239DefMacro('\endmathletters', '\lx@equationgroup@subnumbering@end');
240
241# \eqnum{text}  specifies equation number inside an equation
242# Basically, AMSMath's \tag ?
243DefMacro('\eqnum {}', '\lx@equation@settag{\edef\theequation{#2}\lx@make@tags{equation}}');
244
245#======================================================================
246# 2.13 Citations and Bibliography
247
248DefMacro('\markcite{}', '');    # apparently like \cite w/o text?
249#======================================================================
250# 2.13.1 The thebibliography Environment
251# normal LaTeX
252
253#======================================================================
254# 2.13.2 Specifying Bibliographic and Citation Information
255
256RequirePackage('natbib');
257
258# \bibitem[author(year)]{key} bibdata...
259
260#======================================================================
261# 2.13.3 The references Environment
262
263# Is this the right treatment?
264# Is the same true for RevTeX?
265DefConstructor('\references',
266  "<ltx:bibliography xml:id='#id' "
267    . "bibstyle='#bibstyle' citestyle='#citestyle' sort='#sort'>"
268    . "<ltx:title>#title</ltx:title>"
269    . "<ltx:biblist>",
270  afterDigest => sub { beginBibliography($_[1]); });
271DefConstructor('\endreferences',
272  "</ltx:biblist></ltx:bibliography>");
273
274Let('\reference', '\bibitem');
275
276#======================================================================
277# 2.14.1 Electronic Art
278
279RequirePackage('graphicx');
280# \begin{figure}
281#   \figurenum{text}
282#   \epsscale{num}
283#   \plotone{epsfile}
284#   \plottwo{epsfile}{epsfile}
285#   \caption{text}
286# \end{figure}
287DefMacro('\figurenum{}', '\def\thefigure{#1}');
288# Note: This needs an UnRefStepCounter('figure');
289# or at least, defer the refstep till late enough to skip if needed?
290
291DefMacro('\epsscale{}',           '');
292DefMacro('\plotone Semiverbatim', '\includegraphics[width=\textwidth]{#1}');
293DefMacro('\plottwo Semiverbatim Semiverbatim',
294  '\hbox{\includegraphics[width=\textwidth]{#1}\includegraphics[width=\textwidth]{#2}}');
295
296# \plotfiddle{epsfile}{vsize}{rot}{hsf}{vsf}{htrans}{vtrans}
297# Ugh...
298DefMacro('\plotfiddle Semiverbatim {}{}{}{}{}{}',
299  '\includegraphics[width=#4pt,height=#5pt]{#1}');
300
301#======================================================================
302# 2.14.2 Figure Captions
303
304# For figures added externally; Used at end of file.
305# \figcaption[filename]{text\label{key}}
306# But sometimes used just like \caption!
307DefMacro('\@figcaption {}', '\begin{figure}#1\end{figure}');
308# Note that the optional [filename] seems unused, so we just read and drop it.
309DefMacro('\figcaption OptionalSemiverbatim', sub {
310    (((LookupValue('current_environment') || '') =~ 'figure')
311      ? T_CS('\caption') : T_CS('\@figcaption')); });
312
313#======================================================================
314# 2.15 Tables
315RequirePackage('deluxetable');
316Let(T_CS('\begin{planotable}'), T_CS('\begin{deluxetable}'));
317Let(T_CS('\end{planotable}'),   T_CS('\end{deluxetable}'));
318
319DefConditional('\ifcolnumberson');
320DefConditional('\ifdeluxedecimals');
321DefMacro('\deluxedecimals', '\global\deluxedecimalstrue');
322RawTeX('\global\deluxedecimalsfalse');
323Let(T_CS('\decimals'), T_CS('\deluxedecimals'));
324DefMacro('\colnumbers',              '');                                       # TODO
325DefMacro('\deluxedecimalcolnumbers', '\deluxedecimalstrue\colnumbersontrue');
326Let(T_CS('\decimalcolnumbers'), T_CS('\deluxedecimalcolnumbers'));
327
328# http://tug.ctan.org/tex-archive/macros/latex/contrib/aastex/sample63.pdf
329# decimal alignment, 3.1.2
330sub build_d_columns {
331  $LaTeXML::BUILD_TEMPLATE->addColumn(
332    before => Tokens(T_CS('\hfill'), T_CS('\aas@start@D@column')),
333    after  => Tokens(T_CS('\aas@end@D@column')));
334  $LaTeXML::BUILD_TEMPLATE->addColumn(
335    after => Tokens(T_CS('\hfill')));
336  return; }
337DefColumnType('D', \&build_d_columns);
338DefColumnType('d', \&build_d_columns);
339DefMacro('\aas@start@D@column XUntil:\aas@end@D@column', sub {
340    my ($gullet, $n) = @_;
341    my ($m,      $f) = SplitTokens($n, T_OTHER('.'));
342    return ($f ? (@$m,
343        T_CS('\@ADDCLASS'), T_BEGIN, T_OTHER('ltx_norightpad'), T_END,
344        T_CS('\@alignment@align'),
345        T_CS('\@ADDCLASS'), T_BEGIN, T_OTHER('ltx_noleftpad'), T_END,
346        T_OTHER('.'), @$f)
347      : ($n,
348        T_CS('\@ADDCLASS'), T_BEGIN, T_OTHER('ltx_norightpad'), T_END,
349        T_CS('\@alignment@align')));
350});
351DefPrimitive('\aas@end@D@column', '');
352
353# hidden column, 3.1.4
354Let(T_CS('\savedollar'), T_MATH);
355DefEnvironment('{eatone}', '');
356DefColumnType('h', sub {
357    $LaTeXML::BUILD_TEMPLATE->addColumn(
358      before => Tokens(T_BEGIN,            T_CS('\eatone')),
359      after  => Tokens(T_CS('\endeatone'), T_END));
360    return; });
361Let(T_CS('\begin{splitdeluxetable}'),  T_CS('\begin{deluxetable}'));
362Let(T_CS('\end{splitdeluxetable}'),    T_CS('\end{deluxetable}'));
363Let(T_CS('\begin{splitdeluxetable*}'), T_CS('\begin{deluxetable*}'));
364Let(T_CS('\end{splitdeluxetable*}'),   T_CS('\end{deluxetable*}'));
365
366DefColumnType('B', sub {    # TODO: fake for now, should break table eventually
367    $LaTeXML::BUILD_TEMPLATE->addColumn(
368      before => Tokens(T_BEGIN,            T_CS('\eatone')),
369      after  => Tokens(T_CS('\endeatone'), T_END));
370    return; });
371
372DefEnvironment('{longrotatetable}', '#body');
373
374DefMacro('\phn',   '\phantom{0}');
375DefMacro('\phd',   '\phantom{.}');
376DefMacro('\phs',   '\phantom{+}');
377DefMacro('\phm{}', '\phantom{string}');
378
379#======================================================================
380# 2.15.4 The table Environment
381# normal LaTeX
382
383#======================================================================
384# 2.17 Miscellaneous
385#======================================================================
386# 2.17.1 Celestial Objects and Data Sets
387
388# Ultimately, this would get some more explicit semantic markup, but..
389# \objectname[catalogid]{text}
390# \dataset[catalogid]{text}
391DefConstructor('\objectname OptionalSemiverbatim {}',
392  "<ltx:text class='ltx_ast_objectname'>#2 (catalog #1)</ltx:text>");
393Let('\object', '\objectname');    # ???
394DefConstructor('\dataset OptionalSemiverbatim {}  ',
395  "<ltx:text class='ltx_ast_dataset'>#2 (catalog #1)</ltx:text>");
396
397#======================================================================
398# 2.17.2 Ionic Species and Chemical Bonds
399
400# Note that semantics could be useful!
401#  \ion{element}{level}
402DefMacro('\ion{}{}', '{#1 \uppercase{\romannumeral #2}}');
403
404# NOTE: These are almost totally wrong...
405DefPrimitiveI('\sbond', undef, "\x{2212}");
406DefPrimitiveI('\dbond', undef, "=");
407DefPrimitiveI('\tbond', undef, "\x{2261}");
408
409#======================================================================
410# 2.17.3 Fractions
411
412# \case{1}{2} == textstyle fraction
413# AND, apparently allowed in text mode!
414DefMacro('\case{}{}', '\ensuremath{\text@frac{#1}{#2}}');
415DefConstructor('\text@frac ScriptStyle ScriptStyle',
416  "<ltx:XMApp>"
417    . "<ltx:XMTok meaning='divide' role='FRACOP' mathstyle='text'/>"
418    . "<ltx:XMArg>#1</ltx:XMArg><ltx:XMArg>#2</ltx:XMArg>"
419    . "</ltx:XMApp>",
420  sizer => sub { fracSizer($_[0]->getArg(1), $_[0]->getArg(2)); });
421Let('\slantfrac', '\case');
422#======================================================================
423# 2.17.4 Astronomical Symbols
424# See aassymbols document.
425# Table 1: Additional AASTeX symbols
426
427DefPrimitiveI('\micron', undef, UTF(0xB5) . "m");
428DefMacro('\Sun', '\sun');
429DefMacro('\Sol', '\sun');
430DefPrimitiveI('\sun',     undef, "\x{2609}");
431DefPrimitiveI('\Mercury', undef, "\x{263F}");
432DefPrimitiveI('\Venus',   undef, "\x{2640}");
433DefMacro('\Earth', '\earth');
434DefMacro('\Terra', '\earth');
435DefPrimitiveI('\earth',   undef, "\x{2295}");
436DefPrimitiveI('\Mars',    undef, "\x{2642}");
437DefPrimitiveI('\Jupiter', undef, "\x{2643}");
438DefPrimitiveI('\Saturn',  undef, "\x{2644}");
439DefPrimitiveI('\Uranus',  undef, "\x{2645}");
440DefPrimitiveI('\Neptune', undef, "\x{2646}");
441DefPrimitiveI('\Pluto',   undef, "\x{2647}");
442DefPrimitiveI('\Moon',    undef, "\x{263D}");    # Not sure if this is the right Moon?
443DefMacro('\Luna', '\Moon');
444DefPrimitiveI('\Aries', undef, "\x{2648}");
445DefMacro('\VEq', '\Aries');                      # Vernal Equinox
446DefPrimitiveI('\Taurus', undef, "\x{2649}");
447DefPrimitiveI('\Gemini', undef, "\x{264A}");
448DefPrimitiveI('\Cancer', undef, "\x{264B}");
449DefPrimitiveI('\Leo',    undef, "\x{264C}");
450DefPrimitiveI('\Virgo',  undef, "\x{264D}");
451DefPrimitiveI('\Libra',  undef, "\x{264E}");
452DefMacro('\AEq', '\Libra');                      # Autumnal Equinox
453DefPrimitiveI('\Scorpius',    undef, "\x{264F}");
454DefPrimitiveI('\Sagittarius', undef, "\x{2650}");
455DefPrimitiveI('\Capricornus', undef, "\x{2651}");
456DefPrimitiveI('\Aquarius',    undef, "\x{2652}");
457DefPrimitiveI('\Pisces',      undef, "\x{2653}");
458
459DefPrimitiveI('\diameter', undef, "\x{2300}");
460DefPrimitiveI('\sq',       undef, "\x{25A1}");
461
462DefPrimitiveI('\arcdeg', undef, UTF(0xB0));
463Let('\degr', '\arcdeg');
464DefPrimitiveI('\arcmin', undef, "\x{2032}");
465DefPrimitiveI('\arcsec', undef, "\x{2033}");
466DefMacro('\nodata', ' ~$\cdots$~ ');
467
468# 1st arg is the original macro so that it can be the reversion for UnTeX!
469# 2nd arg is the superscript
470DefConstructor('\aas@@fstack Undigested {}',
471  "<ltx:XMApp role='POSTFIX'>"
472    . "<ltx:XMTok role='SUPERSCRIPTOP' scriptpos='#scriptpos'/>"
473    . "<ltx:XMTok>.</ltx:XMTok>"
474    . "<ltx:XMWrap>#2</ltx:XMWrap>"
475    . "</ltx:XMApp>",
476  properties => { scriptpos => sub { "mid" . $_[0]->getScriptLevel; } },
477  mode => 'math', font => { shape => 'upright' }, bounded => 1, reversion => '#1');
478DefMacro('\aas@fstack{}', '\ensuremath{\aas@@fstack{#1}}');
479
480DefMacro('\fd',    '\ensuremath{\@fd}');
481DefMacro('\fh',    '\ensuremath{\@fh}');
482DefMacro('\fm',    '\ensuremath{\@fm}');
483DefMacro('\fs',    '\ensuremath{\@fs}');
484DefMacro('\fdg',   '\ensuremath{\@fdg}');
485DefMacro('\farcm', '\ensuremath{\@farcm}');
486DefMacro('\farcs', '\ensuremath{\@farcs}');
487DefMacro('\fp',    '\ensuremath{\@fp}');
488
489DefMath('\@fd',  '\aas@@fstack{\fd}{d}',      role => 'ID', meaning => 'day',    alias => '\fd');
490DefMath('\@fh',  '\aas@@fstack{\fh}{h}',      role => 'ID', meaning => 'hour',   alias => '\fh');
491DefMath('\@fm',  '\aas@@fstack{\fm}{m}',      role => 'ID', meaning => 'minute', alias => '\fm');
492DefMath('\@fs',  '\aas@@fstack{\fs}{s}',      role => 'ID', meaning => 'second', alias => '\fs');
493DefMath('\@fdg', '\aas@@fstack{\fdg}{\circ}', role => 'ID', meaning => 'degree', alias => '\fdg');
494DefMath('\@farcm', '\aas@@fstack{\farcm}{\prime}', role => 'ID', meaning => 'arcminute', alias => '\farcm');
495DefMath('\@farcs', '\aas@@fstack{\farcs}{\prime\prime}', role => 'ID', meaning => 'arcsecond', alias => '\farcs');
496DefMath('\@fp', '\aas@@fstack{\fp}{p}');
497
498DefMacro('\onehalf', '\ifmmode\case{1}{2}\else\text@onehalf\fi');
499DefPrimitiveI('\text@onehalf', undef, UTF(0xBD));
500DefMacro('\onethird', '\ifmmode\case{1}{3}\else\text@onethird\fi');
501DefPrimitiveI('\text@onethird', undef, "\x{2153}");
502DefMacro('\twothirds', '\ifmmode\case{2}{3}\else\text@twothirds\fi');
503DefPrimitiveI('\text@twothirds', undef, "\x{2154}");
504DefMacro('\onequarter', '\ifmmode\case{1}{4}\else\text@onequarter\fi');
505DefPrimitiveI('\text@onequarter', undef, UTF(0xBC));
506DefMacro('\threequarters', '\ifmmode\case{3}{4}\else\text@threequarters\fi');
507DefPrimitiveI('\text@threequarters', undef, UTF(0xBE));
508DefPrimitiveI('\ubvr', undef, "UBVR",       bounded => 1, font => { shape => 'italic' });
509DefPrimitiveI('\ub',   undef, "U\x{2000}B", bounded => 1, font => { shape => 'italic' });
510DefPrimitiveI('\bv',   undef, "B\x{2000}V", bounded => 1, font => { shape => 'italic' });
511DefPrimitiveI('\vr',   undef, "V\x{2000}R", bounded => 1, font => { shape => 'italic' });
512DefPrimitiveI('\ur',   undef, "U\x{2000}R", bounded => 1, font => { shape => 'italic' });
513
514# Remaining tables standard LaTeX or amssymb
515RequirePackage('latexsym');
516RequirePackage('amssymb');
517
518# \lesssim,\gtrsim in amssymb
519Let('\la', '\lesssim');
520Let('\ga', '\gtrsim');
521
522# Nominal Conversion Constants
523
524DefMacro('\nomSolarEffTemp', '\leavevmode\hbox{\boldmath$\mathcal{T}^{\rm N}_{\mathrm{eff}\odot}$}');
525DefMacro('\nomTerrEqRadius',      '\leavevmode\hbox{\boldmath$\mathcal{R}^{\rm N}_{E\mathrm e}$}');
526DefMacro('\nomTerrPolarRadius',   '\leavevmode\hbox{\boldmath$\mathcal{R}^{\rm N}_{E\mathrm p}$}');
527DefMacro('\nomJovianEqRadius',    '\leavevmode\hbox{\boldmath$\mathcal{R}^{\rm N}_{J\mathrm e}$}');
528DefMacro('\nomJovianPolarRadius', '\leavevmode\hbox{\boldmath$\mathcal{R}^{\rm N}_{J\mathrm p}$}');
529DefMacro('\nomTerrMass',   '\leavevmode\hbox{\boldmath$(\mathcal{GM})^{\rm N}_{\mathrm E}$}');
530DefMacro('\nomJovianMass', '\leavevmode\hbox{\boldmath$(\mathcal{GM})^{\rm N}_{\mathrm J}$}');
531DefMacro('\Qnom',          '\leavevmode\hbox{\boldmath$\mathcal{Q}^{\rm N}_{\odot}$}');
532Let(T_CS('\Qn'), T_CS('\Qnom'));
533
534# Generic commands that can be given an argument:
535DefMacro('\nom{}',   '\leavevmode\hbox{\boldmath$\mathcal{#1}^{\rm N}_{\odot}$}');
536DefMacro('\Eenom{}', '\leavevmode\hbox{\boldmath$\mathcal{#1}^{\rm N}_{Ee}$}');
537DefMacro('\Epnom{}', '\leavevmode\hbox{\boldmath$\mathcal{#1}^{\rm N}_{Ep}$}');
538DefMacro('\Jenom{}', '\leavevmode\hbox{\boldmath$\mathcal{#1}^{\rm N}_{Je}$}');
539DefMacro('\Jpnom{}', '\leavevmode\hbox{\boldmath$\mathcal{#1}^{\rm N}_{Jp}$}');
540
541#======================================================================
542# 2.17.5 Hypertext Constructs
543# \anchor{href}{text}
544RequirePackage('url');
545
546DefConstructor('\anchor Semiverbatim Semiverbatim',
547  "<ltx:ref href='#href'>#2</ltx:ref>",
548  properties => sub { (href => ComposeURL(LookupValue('BASE_URL'), $_[1])); });
549
550# This should be in effect only after frontmatter
551# \email{address}
552DefConstructor('\@@email Semiverbatim',
553  "<ltx:ref href='#href'>#1</ltx:ref>",
554  properties => sub { (href => CleanURL("mailto:" . ToString($_[1]))); });
555
556# RequirePackage('verbatim');
557
558#======================================================================
559# 2.18 Concluding
560# normal LaTeX
561
562# Number equations within sections
563DefMacro('\eqsecnum',
564  '\@addtoreset{equation}{section}'
565    . '\def\theequation{\arabic{section}-\arabic{equation}}');
566
567#======================================================================
568# Random extra bits
569DefMacroI('\singlespace',    undef, '');
570DefMacroI('\doublespace',    undef, '');
571DefMacroI('\tighten',        undef, '');
572DefMacroI('\tightenlines',   undef, '');
573DefMacroI('\nohyphenation',  undef, '');
574DefMacroI('\offhyphenation', undef, '');
575DefMacroI('\ptlandscape',    undef, '');
576DefMacroI('\refpar',         undef, '');
577DefMacroI('\traceoutput',    undef, '');
578DefMacroI('\tracingplain',   undef, '');
579#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
580
581### These commands requested AAS
582DefMacro('\noprint {}',        '');
583DefMacro('\figsetstart',       '{\bf Fig. Set}');
584DefMacro('\figsetend',         '');
585DefMacro('\figsetgrpstart',    '');
586DefMacro('\figsetgrpend',      '');
587DefMacro('\figsetnum {}',      '{\bf #1.}');
588DefMacro('\figsettitle {}',    '{\bf #1}');
589DefMacro('\figsetgrpnum {}',   '');
590DefMacro('\figsetgrptitle {}', '');
591DefMacro('\figsetplot {}',     '');
592DefMacro('\figsetgrpnote {}',  '');
593
5941;
595