<?xml version="1.0" encoding="UTF-8"?>
<!--
  /=====================================================================\ 
  |  LaTeXML-block.rnc                                                  |
  | RelaxNG model 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 ns="http://dlmf.nist.gov/LaTeXML" 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">
  <define name="Block.class" combine="choice">
    <a:documentation>The block module defines the following `physical' block elements.</a:documentation>
    <choice>
      <ref name="p"/>
      <ref name="equation"/>
      <ref name="equationgroup"/>
      <ref name="quote"/>
      <ref name="block"/>
      <ref name="listing"/>
      <ref name="itemize"/>
      <ref name="enumerate"/>
      <ref name="description"/>
      <ref name="pagination"/>
    </choice>
  </define>
  <define name="Misc.class" combine="choice">
    <a:documentation>These are inline forms of logical lists
(they are included in Misc since that has been the general strategy)</a:documentation>
    <choice>
      <ref name="inline-itemize"/>
      <ref name="inline-enumerate"/>
      <ref name="inline-description"/>
    </choice>
  </define>
  <define name="EquationMeta.class">
    <a:documentation>Additional Metadata that can be present in equations.</a:documentation>
    <ref name="constraint"/>
  </define>
  <!-- ====================================================================== -->
  <define name="p">
    <element name="p">
      <a:documentation>A physical paragraph.</a:documentation>
      <ref name="p_attributes"/>
      <ref name="p_model"/>
    </element>
  </define>
  <define name="p_attributes">
    <a:documentation>Attributes for \elementref{p}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Positionable.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="p_model">
    <a:documentation>Content model for \elementref{p}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="constraint">
    <element name="constraint">
      <a:documentation>A constraint upon an equation.</a:documentation>
      <ref name="constraint_attributes"/>
      <ref name="constraint_model"/>
    </element>
  </define>
  <define name="constraint_attributes">
    <a:documentation>Attributes for \elementref{constraint}.</a:documentation>
    <optional>
      <attribute name="hidden">
        <data type="boolean"/>
      </attribute>
    </optional>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="constraint_model">
    <a:documentation>Content model for \elementref{constraint}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="equation">
    <element name="equation">
      <a:documentation>An Equation.  The model is just Inline which includes \elementref{Math},
the main expected ingredient.
However, other things can end up in display math, too, so we use Inline.
Note that tabular is here only because it's a common, if misguided, idiom;
the processor will lift such elements out of math, when possible</a:documentation>
      <ref name="equation_attributes"/>
      <ref name="equation_model"/>
    </element>
  </define>
  <define name="equation_attributes">
    <a:documentation>Attributes for \elementref{equation}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="equation_model">
    <a:documentation>Content model for \elementref{equation}.</a:documentation>
    <zeroOrMore>
      <choice>
        <ref name="tags"/>
        <ref name="Math"/>
        <ref name="MathFork"/>
        <ref name="text"/>
        <ref name="Misc.class"/>
        <ref name="Meta.class"/>
        <ref name="EquationMeta.class"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="equationgroup">
    <element name="equationgroup">
      <a:documentation>A group of equations, perhaps aligned (Though this is nowhere recorded).</a:documentation>
      <ref name="equationgroup_attributes"/>
      <ref name="equationgroup_model"/>
    </element>
  </define>
  <define name="equationgroup_attributes">
    <a:documentation>Attributes for \elementref{equationgroup}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <ref name="Backgroundable.attributes"/>
    <optional>
      <attribute name="rowsep">
        <a:documentation>the spacing between rows (equations, intertext,...)</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
  </define>
  <define name="equationgroup_model">
    <a:documentation>Content model for \elementref{equationgroup}.</a:documentation>
    <zeroOrMore>
      <choice>
        <ref name="tags"/>
        <ref name="equationgroup"/>
        <ref name="equation"/>
        <ref name="p"/>
        <ref name="Meta.class"/>
        <ref name="EquationMeta.class"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="MathFork">
    <element name="MathFork">
      <a:documentation>A wrapper for Math that provides alternative,
but typically less semantically meaningful,
formatted representations.
The first child is the meaningful form,
the extra children provide formatted forms,
for example being table rows or cells arising from an eqnarray.</a:documentation>
      <ref name="MathFork_attributes"/>
      <ref name="MathFork_model"/>
    </element>
  </define>
  <define name="MathFork_attributes">
    <a:documentation>Attributes for \elementref{MathFork}.</a:documentation>
    <ref name="Common.attributes"/>
  </define>
  <define name="MathFork_model">
    <a:documentation>Content model for \elementref{MathFork}.</a:documentation>
    <choice>
      <ref name="Math"/>
      <ref name="text"/>
    </choice>
    <zeroOrMore>
      <ref name="MathBranch"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="MathBranch">
    <element name="MathBranch">
      <a:documentation>A container for an alternatively formatted math representation.</a:documentation>
      <ref name="MathBranch_attributes"/>
      <ref name="MathBranch_model"/>
    </element>
  </define>
  <define name="MathBranch_attributes">
    <a:documentation>Attributes for \elementref{MathBranch}.</a:documentation>
    <ref name="Common.attributes"/>
    <optional>
      <attribute name="format"/>
    </optional>
  </define>
  <define name="MathBranch_model">
    <a:documentation>Content model for \elementref{MathBranch}.</a:documentation>
    <zeroOrMore>
      <choice>
        <ref name="Math"/>
        <ref name="tr"/>
        <ref name="td"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="quote">
    <element name="quote">
      <a:documentation>A quotation.</a:documentation>
      <ref name="quote_attributes"/>
      <ref name="quote_model"/>
    </element>
  </define>
  <define name="quote_attributes">
    <a:documentation>Attributes for \elementref{quote}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
    <optional>
      <attribute name="role">
        <a:documentation>The kind of quotation; could be something like verse, or translation</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="quote_model">
    <a:documentation>Content model for \elementref{quote}.</a:documentation>
    <ref name="Block.model"/>
  </define>
  <!--
    This was Inline.model, but since quotes can be arbitrarily complex
    including equations, etc, not just verse, should be Block.model, perhaps even Para.model?
  -->
  <!-- ====================================================================== -->
  <define name="block">
    <element name="block">
      <a:documentation>A generic block (fallback).</a:documentation>
      <ref name="block_attributes"/>
      <ref name="block_model"/>
    </element>
  </define>
  <define name="block_attributes">
    <a:documentation>Attributes for \elementref{block}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Positionable.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="block_model">
    <a:documentation>Content model for \elementref{block}.</a:documentation>
    <ref name="Block.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="listing">
    <element name="listing">
      <a:documentation>An Listing, (without caption: see \elementref{float})</a:documentation>
      <ref name="listing_attributes"/>
      <ref name="listing_model"/>
    </element>
  </define>
  <define name="listing_attributes">
    <a:documentation>Attributes for \elementref{listing}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <ref name="Positionable.attributes"/>
    <ref name="Backgroundable.attributes"/>
    <ref name="Data.attributes"/>
  </define>
  <define name="listing_model">
    <a:documentation>Content model for \elementref{listing}.</a:documentation>
    <zeroOrMore>
      <ref name="listingline"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="listingline">
    <element name="listingline">
      <a:documentation>a line in a listing</a:documentation>
      <ref name="listingline_attributes"/>
      <ref name="listingline_model"/>
    </element>
  </define>
  <define name="listingline_attributes">
    <a:documentation>Attributes for \elementref{listingline}</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
  </define>
  <define name="listingline_model">
    <a:documentation>Content model for \elementref{listingline}; Inline.model plus equations</a:documentation>
    <optional>
      <ref name="tags"/>
    </optional>
    <zeroOrMore>
      <choice>
        <text/>
        <ref name="Inline.class"/>
        <ref name="Misc.class"/>
        <ref name="Meta.class"/>
        <ref name="equation"/>
        <ref name="equationgroup"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="itemize">
    <element name="itemize">
      <a:documentation>An itemized list.</a:documentation>
      <ref name="itemize_attributes"/>
      <ref name="itemize_model"/>
    </element>
  </define>
  <define name="itemize_attributes">
    <a:documentation>Attributes for \elementref{itemize}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="itemize_model">
    <a:documentation>Content model for \elementref{itemize}.</a:documentation>
    <zeroOrMore>
      <ref name="item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="enumerate">
    <element name="enumerate">
      <a:documentation>An enumerated list.</a:documentation>
      <ref name="enumerate_attributes"/>
      <ref name="enumerate_model"/>
    </element>
  </define>
  <define name="enumerate_attributes">
    <a:documentation>Attributes for \elementref{enumerate}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="enumerate_model">
    <a:documentation>Content model for \elementref{enumerate}.</a:documentation>
    <zeroOrMore>
      <ref name="item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="description">
    <element name="description">
      <a:documentation>A description list. The \elementref{item}s within are expected to have a \elementref{tag}
which represents the term being described in each \elementref{item}.</a:documentation>
      <ref name="description_attributes"/>
      <ref name="description_model"/>
    </element>
  </define>
  <define name="description_attributes">
    <a:documentation>Attributes for \elementref{description}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="description_model">
    <a:documentation>Content model for \elementref{description}.</a:documentation>
    <zeroOrMore>
      <ref name="item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="item">
    <element name="item">
      <a:documentation>An item within a list (\elementref{itemize},\elementref{enumerate} or \elementref{description}).</a:documentation>
      <ref name="item_attributes"/>
      <ref name="item_model"/>
    </element>
  </define>
  <define name="item_attributes">
    <a:documentation>Attributes for \elementref{item}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <ref name="Backgroundable.attributes"/>
    <optional>
      <attribute name="itemsep">
        <a:documentation>the vertical spacing between items</a:documentation>
        <ref name="Length.type"/>
      </attribute>
    </optional>
  </define>
  <define name="item_model">
    <a:documentation>Content model for \elementref{item}.</a:documentation>
    <optional>
      <ref name="tags"/>
    </optional>
    <ref name="Para.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="inline-itemize">
    <element name="inline-itemize">
      <a:documentation>An inline form of itemized list.</a:documentation>
      <ref name="inline-itemize_attributes"/>
      <ref name="inline-itemize_model"/>
    </element>
  </define>
  <define name="inline-itemize_attributes">
    <a:documentation>Attributes for \elementref{inline-itemize}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="inline-itemize_model">
    <a:documentation>Content model for \elementref{inline-itemize}.</a:documentation>
    <zeroOrMore>
      <ref name="inline-item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="inline-enumerate">
    <element name="inline-enumerate">
      <a:documentation>An inline form of enumerated list.</a:documentation>
      <ref name="inline-enumerate_attributes"/>
      <ref name="inline-enumerate_model"/>
    </element>
  </define>
  <define name="inline-enumerate_attributes">
    <a:documentation>Attributes for \elementref{inline-enumerate}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="inline-enumerate_model">
    <a:documentation>Content model for \elementref{inline-enumerate}.</a:documentation>
    <zeroOrMore>
      <ref name="inline-item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="inline-description">
    <element name="inline-description">
      <a:documentation>An inline form of description list.
The \elementref{inline-item}s within are expected to have a \elementref{tags}
which represents the term being described in each \elementref{inline-item}.</a:documentation>
      <ref name="inline-description_attributes"/>
      <ref name="inline-description_model"/>
    </element>
  </define>
  <define name="inline-description_attributes">
    <a:documentation>Attributes for \elementref{inline-description}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="ID.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="inline-description_model">
    <a:documentation>Content model for \elementref{inline-description}.</a:documentation>
    <zeroOrMore>
      <ref name="inline-item"/>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="inline-item">
    <element name="inline-item">
      <a:documentation>An item within an inline list (\elementref{inline-itemize},\elementref{inline-enumerate}
or \elementref{inline-description}).</a:documentation>
      <ref name="inline-item_attributes"/>
      <ref name="inline-item_model"/>
    </element>
  </define>
  <define name="inline-item_attributes">
    <a:documentation>Attributes for \elementref{item}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <ref name="Backgroundable.attributes"/>
  </define>
  <define name="inline-item_model">
    <a:documentation>Content model for \elementref{inline-item}.</a:documentation>
    <optional>
      <ref name="tags"/>
    </optional>
    <zeroOrMore>
      <choice>
        <ref name="Inline.class"/>
        <ref name="Misc.class"/>
        <ref name="Meta.class"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- ====================================================================== -->
  <define name="tags">
    <element name="tags">
      <a:documentation>A container for one or more \elementref{tag}s.
At most one will have no \attr{role}, which would be the default display.
Other \elementref{tag} will have the role attribute for use in
special forms of referencing.</a:documentation>
      <ref name="tags_model"/>
    </element>
  </define>
  <define name="tags_model">
    <oneOrMore>
      <ref name="tag"/>
    </oneOrMore>
  </define>
  <define name="tag">
    <element name="tag">
      <a:documentation>A tag within an item indicating the term or bullet for a given item.</a:documentation>
      <ref name="tag_attributes"/>
      <ref name="tag_model"/>
    </element>
  </define>
  <define name="tag_attributes">
    <a:documentation>Attributes for \elementref{tag}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Backgroundable.attributes"/>
    <optional>
      <attribute name="role">
        <a:documentation>specifies the purpose this tag is used for: no value is default display</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="open">
        <a:documentation>specifies an open delimiters used to display the tag.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="close">
        <a:documentation>specifies an close delimiters used to display the tag.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="tag_model">
    <a:documentation>Content model for \elementref{tag}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="pagination">
    <element name="pagination">
      <a:documentation>A page break or related pagination information.</a:documentation>
      <ref name="pagination_attributes"/>
      <ref name="pagination_model"/>
    </element>
  </define>
  <define name="pagination_attributes">
    <a:documentation>Attributes for \elementref{pagination}.</a:documentation>
    <ref name="Common.attributes"/>
    <optional>
      <attribute name="role">
        <a:documentation>what kind of pagination</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="pagination_model">
    <a:documentation>Content model for \elementref{pagination}.</a:documentation>
    <empty/>
  </define>
</grammar>
<!-- ====================================================================== -->
