<?xml version="1.0" encoding="UTF-8"?>
<!--
  /=====================================================================\ 
  |  LaTeXML-classes.rnc                                                |
  | Document Type for LaTeXML generated 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=/
-->
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- Basic element classes: -->
  <define name="Inline.class">
    <a:documentation>All strictly inline elements.</a:documentation>
    <notAllowed/>
  </define>
  <define name="Block.class">
    <a:documentation>All `physical' block elements. 
A physical block is typically displayed as a block, but
may not constitute a complete logical unit.</a:documentation>
    <notAllowed/>
  </define>
  <define name="Misc.class">
    <a:documentation>Additional miscellaneous elements that can appear in
both inline and block contexts.</a:documentation>
    <notAllowed/>
  </define>
  <define name="Para.class">
    <a:documentation>All logical block level elements.
A logical block typically contains one or more physical block elements.
For example, a common situation might be \elementref{p},\elementref{equation},\elementref{p},
where the entire sequence comprises a single sentence.</a:documentation>
    <notAllowed/>
  </define>
  <define name="Meta.class">
    <a:documentation>All metadata elements, typically representing hidden data.</a:documentation>
    <notAllowed/>
  </define>
  <!--
    ======================================================================
    Attribute types
  -->
  <define name="Length.type">
    <a:documentation>The type for attributes specifying a length.
Should be a number followed by a length, typically px.
NOTE: To be narrowed later.</a:documentation>
    <text/>
  </define>
  <define name="Color.type">
    <a:documentation>The type for attributes specifying a color.
NOTE: To be narrowed later.</a:documentation>
    <text/>
  </define>
  <!-- ====================================================================== -->
  <define name="Common.attributes">
    <a:documentation>Attributes shared by ALL elements.</a:documentation>
    <optional>
      <!--
         ## provides for namespace declaration.
         attribute xmlns { text }?,
      -->
      <attribute name="class">
        <a:documentation>a space separated list of tokens, as in CSS.
The \attr{class} can be used to add differentiate different instances of elements
without introducing new element declarations.
However, this generally shouldn't be used for deep semantic distinctions.
This attribute is carried over to HTML and can be used for CSS selection.
[Note that the default XSLT stylesheets for html and xhtml
add the latexml element names to the class of html elements
for more convenience in using CSS.]</a:documentation>
        <data type="NMTOKENS"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="cssstyle">
        <a:documentation>CSS styling rules.
These will only be effective when the target system supports CSS.</a:documentation>
      </attribute>
    </optional>
    <ref name="RDF.attributes"/>
    <optional>
      <attribute name="xml:lang">
        <a:documentation>Language attribute</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="ID.attributes">
    <a:documentation>Attributes for elements that can be cross-referenced
from inside or outside the document.</a:documentation>
    <optional>
      <attribute name="xml:id">
        <a:documentation>the unique identifier of the element, 
usually generated automatically by the latexml.</a:documentation>
        <data type="ID"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="fragid">
        <a:documentation>a "fragment identifier" derived from the \attr{xml:id} 
relative to a page split from the complete document.
This is used internally and may go away some day.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="IDREF.attributes">
    <a:documentation>Attributes for elements that can cross-reference other elements.</a:documentation>
    <optional>
      <attribute name="idref">
        <a:documentation>the identifier of the referred-to element.</a:documentation>
        <data type="IDREF"/>
      </attribute>
    </optional>
  </define>
  <define name="Listable.attributes">
    <a:documentation>Attributes for items that can be put into lists, like index, table of contents.</a:documentation>
    <optional>
      <attribute name="inlist">
        <a:documentation>Records which lists, such as toc=table of contents,..., this object could be listed in.
Space separated set of toc, lof, lot, etc.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Listing.attributes">
    <a:documentation>Attributes for items that create lists, like index, table of contents.</a:documentation>
    <optional>
      <attribute name="lists">
        <a:documentation>Records which lists, such as toc(=table of contents), this object should create a list of.
Space separated set of toc, lof, lot, etc.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Labelled.attributes">
    <a:documentation>Attributes for elements that can be labelled from within LaTeX.
These attributes deal with assigning a label  and generating cross references.
The label migrates to an \attr{xml:id} and \attr{href} and the element
can serve as a hypertext target.</a:documentation>
    <ref name="ID.attributes"/>
    <ref name="Listable.attributes"/>
    <optional>
      <attribute name="labels">
        <a:documentation>Records the various labels that LaTeX uses for crossreferencing.
(note that \cs{label} can associate more than one label with an object!)
It consists of space separated labels for the element.
The \cs{label} macro provides the label prefixed by \texttt{LABEL:};
Spaces in a label are replaced by underscore.
Other mechanisms (like acro?) might use other prefixes (but \texttt{ID:} is reserved!)</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Refable.attributes">
    <a:documentation>Attributes for elements that can be referred to from within LaTeX.
Such elements may serve as the starting point of a hypertext link.
The reference can be made using \attr{label}, \attr{xml:id} or \attr{href};
these attributes will be converted, as needed, from the former to the latter.</a:documentation>
    <ref name="IDREF.attributes"/>
    <optional>
      <attribute name="labelref">
        <a:documentation>reference to a LaTeX labelled object;
See the \attr{labels} attribute of \patternref{Labelled.attributes}.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="href">
        <a:documentation>reference to an arbitrary url.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Fontable.attributes">
    <a:documentation>Attributes for elements that contain (indirectly) text whose font can be specified.</a:documentation>
    <optional>
      <attribute name="font">
        <a:documentation>Indicates the font to use. It consists of a space separated sequence
of values representing the
family (\texttt{serif}, \texttt{sansserif}, \texttt{math}, \texttt{typewriter},
    \texttt{caligraphic}, \texttt{fraktur}, \texttt{script}, \ldots),
series (\texttt{medium}, \texttt{bold}, \ldots),
and shape (\texttt{upright}, \texttt{italic}, \texttt{slanted}, \texttt{smallcaps}, \ldots).
Only the values differing from the current context are given.
Each component is open-ended, for extensibility; it is thus unclear
whether unknown values specify family, series or shape.
In postprocessing, these values are carried to the \attr{class} attribute,
and can thus be effected by CSS.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="fontsize">
        <a:documentation>Indicates the text size to use, as a length, as in CSS.
Normally, this should be a percentage value relative to the containing element.</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
  </define>
  <define name="Colorable.attributes">
    <a:documentation>Attributes for elements that draw something, text or otherwise, that can be colored.</a:documentation>
    <optional>
      <attribute name="color">
        <a:documentation>the color to use (for foreground material); any CSS compatible color specification.
In postprocessing, these values are carried to the \attr{class} attribute,
and can thus be effected by CSS.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="opacity">
        <a:documentation>the opacity of foreground material; a number between 0 and 1.</a:documentation>
        <data type="float"/>
      </attribute>
    </optional>
  </define>
  <define name="Backgroundable.attributes">
    <a:documentation>Attributes for elements that take up space and make sense to have a background color.
This is independent of the colors of any things that it may draw.</a:documentation>
    <optional>
      <attribute name="backgroundcolor">
        <a:documentation>the color to use for the background of the element; any CSS compatible color specification.
In postprocessing, these values are carried to the \attr{class} attribute,
and can thus be effected by CSS; the background will presumably
correspond to a bounding rectangle, but is determined by the CSS rendering engine.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Positionable.attributes">
    <a:documentation>Attributes shared by low-level, generic inline and block elements
that can be sized or shifted.</a:documentation>
    <optional>
      <attribute name="width">
        <a:documentation>the desired width of the box</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="height">
        <a:documentation>the desired height of the box</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="depth">
        <a:documentation>the desired depth of the box</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="xoffset">
        <a:documentation>horizontal shift the position of the box.</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="yoffset">
        <a:documentation>vertical shift the position of the box.</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="align">
        <a:documentation>alignment of material within the box.</a:documentation>
        <choice>
          <value>left</value>
          <value>center</value>
          <value>right</value>
          <value>justified</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="vattach">
        <a:documentation>specifies which line of the box is aligned to the baseline of the containing object.
The default is baseline. </a:documentation>
        <choice>
          <value>top</value>
          <value>middle</value>
          <value>bottom</value>
          <value>baseline</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="float">
        <a:documentation>the horizontal floating placement parameter that determines where the object is displayed.</a:documentation>
        <choice>
          <value>right</value>
          <value>left</value>
          <text/>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="framed">
        <a:documentation>the kind of frame or outline for the box.</a:documentation>
        <choice>
          <value>rectangle</value>
          <value>underline</value>
          <text/>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="framecolor">
        <a:documentation>the color of the frame or outlie for the box.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Transformable.attributes">
    <a:documentation>Attributes shared by (hopefully few) elements that can be transformed.
Such elements should also have Positionable.attributes.
Transformation order of an individual element is assumed to be
translate, scale, rotate; wrap elements to achieve different orders.
Attributes \attr{innerwidth}, \attr{innerheight} and \attr{innerdepth} describe
the size of the contents of the element before transformation;
The result size would be encoded in Positional.attributes.</a:documentation>
    <optional>
      <attribute name="xtranslate">
        <a:documentation>horizontal shift the position of the inner element.</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="ytranslate">
        <a:documentation>vertical shift the position of the inner element.</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="xscale">
        <a:documentation>horizontal scaling of the inner element.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="yscale">
        <a:documentation>vertical scalign of the inner element.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="angle">
        <a:documentation>the rotation angle, counter-clockwise, in degrees.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="innerwidth">
        <a:documentation>the expected width of the contents of the inner element</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="innerheight">
        <a:documentation>the expected height of the contents of the inner element</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="innerdepth">
        <a:documentation>the expected depth of the contents of the inner element</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
  </define>
  <define name="Imageable.attributes">
    <a:documentation>Attributes for elements that may be converted to image form
during postprocessing, such as math, graphics, pictures, etc.
Note that these attributes are generally not filled in until postprocessing,
but that they could be init</a:documentation>
    <optional>
      <attribute name="imagesrc">
        <a:documentation>the file, possibly generated from other data.</a:documentation>
        <data type="anyURI"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="imagewidth">
        <a:documentation>the width in pixels of \attr{imagesrc}.</a:documentation>
        <data type="nonNegativeInteger"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="imageheight">
        <a:documentation>the height in pixels of \attr{imagesrc}.
Note that, unlike \TeX, this is the total height, including the depth (if any).</a:documentation>
        <data type="nonNegativeInteger"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="imagedepth">
        <a:documentation>the depth in pixels of \attr{imagesrc}, being the location of the
baseline of the content shown in the image.
When displayed inilne, an image with a positive \attr{depth}
should be shifted down relative to the baseline of neighboring material.</a:documentation>
        <data type="integer"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="description">
        <a:documentation>a description of the image</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="RDF.attributes">
    <a:documentation>Attributes for RDFa (Resource Description Framework),
following RDFa Core 1.1 \url{http://www.w3.org/TR/rdfa-syntax/}.
The following descriptions give a short overview of the usage of the attributes,
but see the specification for the complete details, which are sometimes complex.</a:documentation>
    <optional>
      <attribute name="vocab">
        <a:documentation>indicates the default vocabulary
(generally should be managed by LaTeXML and only appear on root node)</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="prefix">
        <a:documentation>specifies a mapping between CURIE prefixes and IRI (URI).
(generally should be managed by LaTeXML and only appear on root node)</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="about">
        <a:documentation>indicates the subject for predicates appearing on the same or descendant nodes.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="aboutlabelref">
        <a:documentation>gives the label for the document element that serves as the subject;
it will be converted to \attr{aboutidref} and \attr{about} during post-processing.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="aboutidref">
        <a:documentation>gives the id for the document element that serves as the subject;
it will be converted to \attr{about} during post-processing.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="resource">
        <a:documentation>indicates the subject for predicates appearing on descendant nodes,
and also indicates the object for predicates
when \attr{property} appears on the same node,
or when \attr{rel} or \attr{rev} appears on an ancestor.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="resourcelabelref">
        <a:documentation>gives the label for the document element that serves as the resource object;
it will be converted to \attr{resourceidref} and \attr{resource} during post-processing.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="resourceidref">
        <a:documentation>gives the id for the document element that serves as the resource object;
it will be converted to \attr{resource} during post-processing.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="property">
        <a:documentation>indicates the predicate and
asserts that the subject is related by that predicate to the object.
The subject is determined by one of \attr{about} on same node,
\attr{resource} or \attr{typeof} on an ancestor node, or by the document root.
The object is determined by one of \attr{resource}, \attr{href}, \attr{content}
or \attr{typeof} on the same node, or by the text content of the node.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="rel">
        <a:documentation>indicates the predicate exactly as \attr{property} except that it can
assert multiple RDF triples where the objects are the nearest descendent \attr{resource}s.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="rev">
        <a:documentation>indicates the predicate exactly as \attr{rel} except that it indicates
the reverse relationship (with subject and object swapped).</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="typeof">
        <a:documentation>indicates the type of the \attr{resource} and thus implicitly asserts a relation
that the object has the given type.
Additionally, if no \attr{resource} was given on the same node,
indicates an anonymous subject and or object exactly as \attr{resource}</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="datatype">
        <a:documentation>indicates the datatype of the target resource;</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="content">
        <a:documentation>indicates the content of the property to be used as the object,
to be used instead of the content of the element itself;</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="Data.attributes">
    <a:documentation>Attributes for raw data storage</a:documentation>
    <optional>
      <attribute name="data">
        <a:documentation>the data itself</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="datamimetype">
        <a:documentation>the MIME type of the data</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="dataencoding">
        <a:documentation>the encoding of the data (either empty, base64, or )</a:documentation>
      </attribute>
    </optional>
  </define>
</grammar>
