<var>

The <var> element is used inside <webwork> content to insert a WeBWorK variable, answer blank, or other interactive answer control. In prose it can display a generated value, and with attributes such as width or form it can create an input widget.

Use <var> in authored <statement>, <hint>, and <solution> content for a WeBWorK problem.

Syntax

Attributes

Attributes for <var>
AttributeRequired?Values
category = "…"optional"angle""decimal""exponent""formula""fraction""inequality""integer""interval""logarithm""limit""number""point""syntax""quantity""vector"
evaluator = "…"optionalstring
form = "…"optional"essay"
name = "…"optionalstring
width = "…"optionalstring

Children

This tag must be empty (i.e., no children or text allowed).

Parents

This element may appear as an immediate child of the following elements: <alert> <angles> <articletitle> <attribution> <biblio> <caption> <cell> <dblbrackets> <delete> <em> <entity> <fn> <foreign> <insert> <intertext> <li> <line> <m> <md> <mrow> <p> <pubtitle> <q> <shortdescription> <shortlicense> <sq> <stale> <subtitle> <support> <term> <title>

Examples

<exercise>
    <webwork>
        <pg-code>
            $a = Compute(2);
            $b = Compute(5);
            $c = $a + $b;
        </pg-code>
        <statement>
            <p>
                Compute <m><var name="$a"/> + <var name="$b"/> =</m>
                <var name="$c" width="5"/>.
            </p>
        </statement>
    </webwork>
</exercise>