% /=====================================================================\ %
% |  latexml.sty                                                        | %
% | Style file for latexml documents                                    | %
% |=====================================================================| %
% | 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=/ %


% You can conditionalize code for latexml or normal latex using this.
\newif\iflatexml\latexmlfalse
%======================================================================
\DeclareOption{ids}{}
\DeclareOption{noids}{}
\DeclareOption{comments}{}
\DeclareOption{nocomments}{}
\DeclareOption{tracing}{\tracingall}
\DeclareOption{notracing}{\tracingnone}
\DeclareOption{profiling}{}
\DeclareOption{noprofiling}{}
\DeclareOption{mathparserspeculate}{}
\DeclareOption{nomathparserspeculate}{}
\DeclareOption{guesstabularheaders}{}
\DeclareOption{noguesstabularheaders}{}
% Just ignore unknown options, so that binding can evolve more easily.
\DeclareOption*{\PackageWarning{latexml}{option  \CurrentOption\space ignored}}
\ProcessOptions
%======================================================================
% NOTE: Figure out where this should go.
%  At least should define various `semantic enhancement' macros that
% authors using latexml might want.
% But, be careful not to step on the toes of other packages (naming scheme),
% Nor, to assume to much about what semantics authors might want.
% NOTE: Am I stepping on toes by including these here?
% Common markup junk for LaTeXML docs.
\providecommand{\XML}{\textsc{xml}}%
\providecommand{\SGML}{\textsc{sgml}}%
\providecommand{\HTML}{\textsc{html}}%
\providecommand{\XHTML}{\textsc{xhtml}}%
\providecommand{\XSLT}{\textsc{xslt}}%
\providecommand{\CSS}{\textsc{css}}%
\providecommand{\MathML}{\textsc{MathML}}%
\providecommand{\OpenMath}{OpenMath}%

\RequirePackage{url}
% Shorthand to present a URL the actual text (also linked in HTML)
% \URL[alternative text]{url}
\def\URL{\@ifnextchar[{\@URL}{\@@URL}}%]
%\def\@@URL{\begingroup\def\UrlLeft##1\UrlRight{\stepcounter{footnote}%
%[Footnote~\thefootnote\footnotetext{##1}]}\Url}
\def\@@URL{\begingroup\Url}
\def\@URL[#1]{#1\begingroup\def\UrlLeft##1\UrlRight{\footnote{\texttt{##1}}}\Url}

% The LaTeXML Logo.
\DeclareRobustCommand{\LaTeXML}{L\kern-.36em%
        {\sbox\z@ T%
         \vbox to\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.15em%
%        T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em\relax
%        {\tt XML}}
        T\kern-.1667em\lower.4ex\hbox{E}\kern-0.05em\relax
        {\scshape xml}}%

\providecommand{\LaTeXMLversion}{}
\providecommand{\LaTeXMLrevision}{}
\providecommand{\LaTeXMLfullversion}{\LaTeXML}

%======================================================================
% id related features
\providecommand{\lxDocumentID}[1]{}%
\def\LXMID#1#2{\expandafter\gdef\csname xmarg#1\endcsname{#2}\csname xmarg#1\endcsname}
\def\LXMRef#1{\csname xmarg#1\endcsname}

%======================================================================
% class related features
% Add a class to the constructed xml (ignored in latex)
\providecommand{\lxAddClass}[1]{}%
\providecommand{\lxWithClass}[2]{#2}%
\providecommand{\lxAddAnnotation}[1]{}%
\providecommand{\lxWithAnnotation}[2]{#2}%

%======================================================================
% links
\def\lxRef#1#2{#2}
%======================================================================
% Resources
\providecommand{\lxRequireResource}[2][]{}

%======================================================================
% Page customization
\def\lxKeywords#1{}

\RequirePackage{comment}
\def\lxContextTOC{}%
\excludecomment{lxNavbar}
\excludecomment{lxHeader}
\excludecomment{lxFooter}

%======================================================================
% Table beautification.
% Low-level support to mark column and row headers.
% This really calls for styling, but why should we get into that game?
% There are many other packages for that.

% To mark the table head/foot (table column headers)
% Put this before first table heading row
\def\lxBeginTableHead{}
% put this after the \\ ending the table heading.
\def\lxEndTableHead{}
% Ditto for table foot (last rows in table)
\def\lxBeginTableFoot{}
\def\lxEndTableFoot{}

% To mark an individual cell as a column header
\def\lxTableColumnHead{}
% To mark an individual cell as a row header
\def\lxTableRowHead{}
% Easy way to mark a whole column as row headers:
%  \usepackage{array}
% then put this in the column spec
%  >{\lxTableRowHead}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Declarative information for Mathematics
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%======================================================================
% Marking the type of particular instances of a symbol
% Expose other declarative macros
\providecommand{\lxFcn}[1]{#1}
\providecommand{\lxID}[1]{#1}
\providecommand{\lxPunct}[1]{#1}
\providecommand{\lxMathTweak}[2]{#2}
%======================================================================
% Math definining macro.
% Define a math function such that the TeX output is what you might
% expect, while providing the semantic hooks for generating useful xml.

% \lxDefMath{\cs}[nargs][optargs]{presentation}[declarations]
\providecommand{\lxDefMath}{\lx@defmath}%
\def\lx@defmath#1{%
  \@ifnextchar[{\lx@defmath@a{#1}}{\lx@defmath@a{#1}[0]}}%
\def\lx@defmath@a#1[#2]{%
  \@ifnextchar[{\lx@defmath@opt{#1}[#2]}{\lx@defmath@noopt{#1}[#2]}}%
\def\lx@defmath@opt#1[#2][#3]#4{%
  \providecommand{#1}[#2][#3]{#4}%
  \@ifnextchar[{\lx@@skipopt}{}}%
\def\lx@defmath@noopt#1[#2]#3{%
  \providecommand{#1}[#2]{#3}%
  \@ifnextchar[{\lx@@skipopt}{}}%
\def\lx@@skipopt[#1]{}%

% \lxDeclare[declarations]{match}
\newcommand{\lxDeclare}[2][]{\@bsphack\@esphack}%
% \lxDeclRef{label}
\newcommand{\lxRefDeclaration}[2][]{\@bsphack\@esphack}%

% NOTE: It would be good to incorporate Scoping into this macro.
% As defined, it obeys TeX's usual grouping scope.
% However, scoping by `module' (M.Kohlhase's approach) and/or
% `document' scoping could be useful.

% In module scoping, the definition is only available within a
% module environment that defines it, AND in other module envs
% that `use' it.

% In document scoping, the definition would only be available within
% the current sectional unit.  I'm not sure the best way to achieve this
% within latex, itself, but have ideas about latexml...
% But, perhaps it is only the declarative aspects that are important to
% latexml...
