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

#======================================================================
foreach my $option (qw(nospthms vecphys vecarrow norunningheads referee oribibl chaprefs
  footinfo openany sechang
  deutsch francais),
  # These could affect numbering...
  qw(numart book envcountresetchap envcountresetsect envcountsame envcountchap
  envcountresetsect envcountresetchap),
  qw(natbib)) {
  DeclareOption($option, undef); }

# Other options could load sv<option>.clo !
# Anything else gets passed to book.
DeclareOption(undef, sub {
    PassOptions('book', 'cls', ToString(Expand(T_CS('\CurrentOption')))); });

ProcessOptions();
LoadClass('book', withoptions => 1);
RequirePackage('sv_support');
RequirePackage('url');    # included in later versions?

# Oddly, they allow * on \title to affect numbering (* => numart, none => book)
# Hopefully we can get away with just reseting the display of section numbers?
DefMacro('\title OptionalMatch:* {}',
  '\if.#1.\else\def\thesection{\arabic{section}}\fi'
    . '\@add@frontmatter{ltx:title}{#2}');

#======================================================================
# And some additional stuff
DefMath('\ualpha', "\x{03B1}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER ALPHA
DefMath('\ubeta', "\x{03B2}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER BETA
DefMath('\uchi', "\x{03C7}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER CHI
DefMath('\udelta', "\x{03B4}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER DELTA
DefMath('\ugamma', "\x{03B3}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER GAMMA
DefMath('\umu', "\x{03BC}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER MU
DefMath('\unu', "\x{03BD}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER NU
DefMath('\upi', "\x{03C0}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER PI
DefMath('\utau', "\x{03C4}", font => { shape => 'upright', forceshape => 1 }); # GREEK SMALL LETTER TAU

DefMath('\varDelta',   "\x{0394}", font => { shape => 'italic' });
DefMath('\varGamma',   "\x{0393}", font => { shape => 'italic' });
DefMath('\varLambda',  "\x{039B}", font => { shape => 'italic' });
DefMath('\varOmega',   "\x{03A9}", font => { shape => 'italic' });
DefMath('\varPhi',     "\x{03A6}", font => { shape => 'italic' });
DefMath('\varPi',      "\x{03A0}", font => { shape => 'italic' });
DefMath('\varPsi',     "\x{03A8}", font => { shape => 'italic' });
DefMath('\varSigma',   "\x{03A3}", font => { shape => 'italic' });
DefMath('\varTheta',   "\x{0398}", font => { shape => 'italic' });
DefMath('\varUpsilon', "\x{03A5}", font => { shape => 'italic' });
DefMath('\varXi',      "\x{039E}", font => { shape => 'italic' });

DefPrimitiveI('\bbbc',   undef, "\x{2102}");    #not sure if ok for the ones NOT of type I$
DefPrimitiveI('\bbbf',   undef, "\x{1D53D}");
DefPrimitiveI('\bbbh',   undef, "\x{210D}");
DefPrimitiveI('\bbbk',   undef, "\x{1D542}");
DefPrimitiveI('\bbbm',   undef, "\x{1D544}");
DefPrimitiveI('\bbbn',   undef, "\x{2115}");
DefPrimitiveI('\bbbone', undef, "\x{1D7D9}");
DefPrimitiveI('\bbbp',   undef, "\x{2119}");
DefPrimitiveI('\bbbq',   undef, "\x{211A}");
DefPrimitiveI('\bbbr',   undef, "\x{211D}");
DefPrimitiveI('\bbbs',   undef, "\x{1D54A}");
DefPrimitiveI('\bbbt',   undef, "\x{1D54B}");
DefPrimitiveI('\bbbz',   undef, "\x{2124}");

DefMath('\getsto', "\x{21C6}", role => 'ARROW');
DefMath('\lid',    "\x{2266}", role => 'RELOP', meaning => 'less-than-or-equals');
DefMath('\gid',    "\x{2267}", role => 'RELOP', meaning => 'greater-than-or-equals');
DefMath('\grole',  "\x{2277}", role => 'RELOP', meaning => 'greater-than-or-less-than');
Let('\qedsymbol', '\qed');

#  special signs and characters
DefMacro('\D', '\mathrm{d}');
DefMacro('\E', '\mathrm{e}');
Let('\eul', '\E');
DefMacro('\I', '{\rm i}');
Let('\imag', '\I');

DefMacro('\partsize',    '\Large');
DefMacro('\partstyle',   '\bfseries\boldmath');
DefMacro('\chapsize',    '\Large');
DefMacro('\chapstyle',   '\bfseries\boldmath');
DefMacro('\secsize',     '\large');
DefMacro('\secstyle',    '\bfseries\boldmath');
DefMacro('\subsecsize',  '\normalsize');
DefMacro('\subsecstyle', '\bfseries\boldmath');

DefMacro('\chaptermark{}',    '');
DefMacro('\sectionmark{}',    '');
DefMacro('\subsectionmark{}', '');
DefMacro('\tocauthorstyle',   '\itshape');
DefMacro('\toctitlestyle',    '\bfseries');
DefMacro('\tocaftauthskip',   '\z@');

DefMacro('\preface{}',   '\chapter*{#1}');
DefMacro('\prefacename', 'Preface');

DefMacro('\propositionname', 'Proposition');

DefRegister('\tocchpnum'         => Dimension(0));
DefRegister('\tocsecnum'         => Dimension('18pt'));
DefRegister('\tocsectotal'       => Dimension(0));
DefRegister('\tocsubsecnum'      => Dimension(0));
DefRegister('\tocsubsectotal'    => Dimension(0));
DefRegister('\tocsubsubsecnum'   => Dimension(0));
DefRegister('\tocsubsubsectotal' => Dimension(0));
DefRegister('\tocparanum'        => Dimension(0));
DefRegister('\tocparatotal'      => Dimension(0));
DefRegister('\tocsubparanum'     => Dimension(0));

DefMacro('\dominitoc',     '');
DefMacro('\calctocindent', '');

DefMacro('\clearheadinfo',        '');
DefMacro('\clearemptydoublepage', '');

### Hmm,
# and apparently needs support for subfigures & subequations

1;