Skip to main content

The PreTeXt Guide

Subsection 7.1.6 Reusing a <webwork> by @xml:id

If a <webwork> has an @xml:id, then another <webwork> can “copy” the first one simply by using a @copy attribute whose value is the first <webwork>’s @xml:id. The @seed of the first <webwork> is ignored, and the second <webwork> may set its own @seed. For example:
  <webwork xml:id="foo" seed="1">
      $a = random(1,9,1);
      $answer = $a+1;
        Enter <m><var name="$a"/>+1</m>.  <var name="$answer" width="10"/>

  <webwork copy="foo" seed="2"/>
The @copy attribute should point to a <webwork> that has PreTeXt-authored source, not to a <webwork> with a @source attribute. (If you want to copy one with a @source attribute, just reuse the same @source value.)