<?xml version="1.0" encoding="UTF-8"?>

<?context-directive job ctxfile x-setups.ctx ?>

<cd:interface xmlns:cd="http://www.pragma-ade.com/commands">

    <cd:command name="defineformula" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-name-optional"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupformula"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupformula" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:assignments list="yes">
                <cd:parameter name="location">
                    <cd:constant type="left"/>
                    <cd:constant type="right" default="yes"/>
                </cd:parameter>
                <cd:parameter name="align">
                    <cd:constant type="left"/>
                    <cd:constant type="middle"/>
                    <cd:constant type="right"/>
                    <cd:constant type="flushleft"/>
                    <cd:constant type="center"/>
                    <cd:constant type="flushright"/>
                    <cd:constant type="normal"/>
                </cd:parameter>
                <cd:parameter name="split">
                    <cd:constant type="yes"/>
                    <cd:constant type="no" default="yes"/>
                    <cd:constant type="page"/>
                </cd:parameter>
                <cd:parameter name="strut">
                    <cd:constant type="yes"/>
                    <cd:constant type="no" default="yes"/>
                </cd:parameter>
                <cd:parameter name="distance">
                    <cd:constant type="cd:dimension"/>
                </cd:parameter>
                <cd:parameter name="left">
                    <cd:constant type="cd:command"/>
                </cd:parameter>
                <cd:parameter name="right">
                    <cd:constant type="cd:command"/>
                </cd:parameter>
                <cd:parameter name="spacebefore">
                    <cd:inherit name="blank"/>
                </cd:parameter>
                <cd:parameter name="spaceafter">
                    <cd:inherit name="blank"/>
                </cd:parameter>
                <cd:parameter name="numbercommand">
                    <cd:constant type="cd:oneargument"/>
                </cd:parameter>
                <cd:parameter name="color">
                    <cd:constant type="cd:color"/>
                </cd:parameter>
                <cd:parameter name="numberstyle">
                    <cd:resolve name="value-style"/>
                </cd:parameter>
                <cd:parameter name="numbercolor">
                    <cd:constant type="cd:color"/>
                </cd:parameter>
                <cd:parameter name="option">
                    <cd:resolve name="value-formula"/>
                </cd:parameter>
                <cd:parameter name="margin">
                    <cd:resolve name="value-leftskip"/>
                </cd:parameter>
                <cd:parameter name="leftmargin">
                    <cd:constant type="cd:dimension"/>
                </cd:parameter>
                <cd:parameter name="rightmargin">
                    <cd:constant type="cd:dimension"/>
                </cd:parameter>
                <cd:parameter name="alternative">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="indentnext">
                    <cd:resolve name="value-indentnext"/>
                </cd:parameter>
                <cd:parameter name="grid">
                    <cd:inherit name="snaptogrid"/>
                </cd:parameter>
                <cd:parameter name="frame">
                    <cd:constant type="number"/>
                </cd:parameter>
                <cd:parameter name="hang">
                    <cd:constant type="none" default="yes"/>
                    <cd:constant type="auto"/>
                </cd:parameter>
                <cd:parameter name="expansion">
                    <cd:constant type="yes"/>
                    <cd:constant type="no" default="yes"/>
                    <cd:constant type="xml"/>
                </cd:parameter>
                <cd:parameter name="referenceprefix">
                    <cd:resolve name="value-referenceprefix"/>
                </cd:parameter>
                <cd:parameter name="xmlsetup">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="catcodes">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:inherit name="setupcounter"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupformulas" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:assignments list="yes">
                <cd:inherit name="setupformula"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="definesubformula" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-name-optional"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupsubformula"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupsubformula" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:assignments list="yes">
                <cd:parameter name="indentnext">
                    <cd:resolve name="value-indentnext"/>
                </cd:parameter>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupsubformulas" level="style" category="mathematics" file="math-for.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:assignments list="yes">
                <cd:inherit name="setupsubformula"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="formula" type="environment" generated="yes" variant="instance" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:sequence>
            <cd:instance value="formula"/>
            <cd:string value="formula"/>
        </cd:sequence>
        <cd:arguments>
            <cd:resolve name="keyword-formula-list-optional"/>
        </cd:arguments>
        <cd:instances>
            <cd:resolve name="instance-formula"/>
        </cd:instances>
    </cd:command>

    <!--

        <cd:command name="formula" type="environment" generated="yes" variant="instance:assignment" level="document" category="mathematics" file="strc-mat.mkiv">
            <cd:sequence>
                <cd:instance value="formula"/>
                <cd:string value="formula"/>
            </cd:sequence>
            <cd:arguments>
                <cd:assignments list="yes" optional="yes">
                    <cd:inherit name="setupformula"/>
                </cd:assignments>
            </cd:arguments>
            <cd:instances>
                <cd:resolve name="instance-formula"/>
            </cd:instances>
        </cd:command>

    -->

    <cd:command name="formula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formula-list-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="formula" type="environment" variant="assignment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:assignments list="yes" optional="yes">
                <cd:parameter name="option">
                    <cd:resolve name="value-formula"/>
                </cd:parameter>
                <cd:parameter name="margin">
                    <cd:resolve name="value-leftskip"/>
                </cd:parameter>
                <cd:parameter name="grid">
                    <cd:inherit name="snaptogrid"/>
                </cd:parameter>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <!--

        <cd:command name="spformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
            <cd:arguments>
                <cd:resolve name="keyword-formula-list-optional"/>
            </cd:arguments>
        </cd:command>

        <cd:command name="sdformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
            <cd:arguments>
                <cd:resolve name="keyword-formula-list-optional"/>
            </cd:arguments>
        </cd:command>

        <cd:command name="mpformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
            <cd:arguments>
                <cd:resolve name="keyword-formula-list-optional"/>
            </cd:arguments>
        </cd:command>

        <cd:command name="mdformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
            <cd:arguments>
                <cd:resolve name="keyword-formula-list-optional"/>
            </cd:arguments>
        </cd:command>

    -->

    <cd:command name="defineformulaalternative" level="system" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-csname"/>
            <cd:resolve name="keyword-csname"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="formula" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formula-list-optional"/>
            <cd:content/>
        </cd:arguments>
    </cd:command>

    <cd:command name="displaymath" type="environment" level="system" category="mathematics" file="strc-mat.mkiv"/>

    <cd:command name="formulas" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="subformulas" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="namedsubformulas" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
            <cd:resolve name="argument-text"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="placeformula" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
            <cd:resolve name="argument-text-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="placeformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:assignments list="yes" optional="yes">
                <cd:parameter name="title">
                    <cd:constant type="cd:text"/>
                </cd:parameter>
                <cd:parameter name="suffix">
                    <cd:constant type="cd:text"/>
                </cd:parameter>
                <cd:parameter name="reference">
                    <cd:resolve name="value-formulareference"/>
                </cd:parameter>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="placeformula" type="environment" variant="argument" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="placenamedformula" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
            <cd:resolve name="argument-text"/>
            <cd:resolve name="argument-text-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="placesubformula" level="document" category="mathematics" file="strc-mat.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-formulareference-list-optional"/>
            <cd:resolve name="argument-text-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="formulanumber" level="document" category="mathematics" file="strc-mat">
        <cd:arguments>
            <cd:resolve name="keyword-reference-list-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="placecurrentformulanumber" level="system" category="mathematics" file="strc-mat"/>

    <cd:command name="alignhere" scope="formula" level="document" category="mathematics" file="strc-mat"/>

    <cd:command name="breakhere" scope="formula" level="document" category="mathematics" file="strc-mat"/>

    <cd:command name="splitformula" type="environment" level="document" category="mathematics" file="strc-mat.mkiv"/>

</cd:interface>
