Diff for /loncom/html/adm/help/tex/Authoring_Library_Scripts.tex between versions 1.4 and 1.5

version 1.4, 2016/08/20 14:52:57 version 1.5, 2017/01/19 21:12:45
Line 15  into a problem file. \index{library}\ind Line 15  into a problem file. \index{library}\ind
 \noindent Library file:  \noindent Library file:
 \begin{verbatim}  \begin{verbatim}
 <library>  <library>
 <script type="loncapa/perl">    <script type="loncapa/perl">
 @alpha=('A','B','C','D',);      @alpha=('A','B','C','D',);
 $seed=&random(1,1000000,1);      $seed=&random(1,1000000,1);
 @alpha=&random_permutation($seed,@alpha); #scramble order      @alpha=&random_permutation($seed,@alpha); #scramble order
 $letter = $alpha[0]; #select first element      $letter = $alpha[0]; #select first element
 </script>    </script>
 </library>  </library>
 \end{verbatim}  \end{verbatim}
   
 \noindent Problem file:  \noindent Problem file:
 \begin{verbatim}  \begin{verbatim}
 <problem>  <problem>
 <import id="15">randomletter.library</import>    <import id="15">randomletter.library</import>
 <startouttext />The random letter is $letter.<endouttext />    <startouttext />The random letter is $letter.<endouttext />
 <!-- other problem tags could go here -->    <!-- other problem tags could go here -->
 </problem>  </problem>
 \end{verbatim}  \end{verbatim}
   
Line 42  A portion of a script, such as a large d Line 42  A portion of a script, such as a large d
 \noindent Library file:  \noindent Library file:
 \begin{verbatim}  \begin{verbatim}
 <library>  <library>
 <script type="loncapa/perl">    <script type="loncapa/perl">
 @alpha=('A','B','C','D',);      @alpha=('A','B','C','D',);
 $seed=&random(1,1000000,1);      $seed=&random(1,1000000,1);
 @alpha=&random_permutation($seed,@alpha); #scramble order      @alpha=&random_permutation($seed,@alpha); #scramble order
 </script>    </script>
 </library>  </library>
 \end{verbatim}  \end{verbatim}
   
Line 54  $seed=&random(1,1000000,1); Line 54  $seed=&random(1,1000000,1);
 script calculations can be done using variables from the library file.)  script calculations can be done using variables from the library file.)
 \begin{verbatim}  \begin{verbatim}
 <problem>  <problem>
 <import id="15">randomletter.library</import>    <import id="15">randomletter.library</import>
 <script type="loncapa/perl">    <script type="loncapa/perl">
 $letter = $alpha[0];      $letter = $alpha[0];
 </script>    </script>
 <startouttext />The random letter is $letter.<endouttext />    <startouttext />The random letter is $letter.<endouttext />
 <!-- other problem tags could go here. -->    <!-- other problem tags could go here. -->
 </problem>  </problem>
 \end{verbatim}  \end{verbatim}
   
Line 80  some arguments: \$eq,`x',`y',`z' in the Line 80  some arguments: \$eq,`x',`y',`z' in the
   
 \begin{verbatim}  \begin{verbatim}
 <problem>  <problem>
 <import id="15">/res/msu/raeburn/cleaneq.library</import>    <import id="15">/res/msu/raeburn/cleaneq.library</import>
   
 <script type="loncapa/perl">    <script type="loncapa/perl">
 $eq = "1x + 0y +-7z --3";      $eq = "1x + 0y +-7z --3";
 $eq2 = &cleaneq($eq,'x','y','z');</script>      $eq2 = &cleaneq($eq,'x','y','z');
 <startouttext />Here is an example equation:<br />    </script>
 Without cleaneq: $eq<br />    <startouttext />Here is an example equation:<br />
 With cleaneq: $eq2<endouttext />    Without cleaneq: $eq<br />
     With cleaneq: $eq2<endouttext />
 </problem>  </problem>
 \end{verbatim}  \end{verbatim}
   
Line 99  The .library file Line 100  The .library file
 hold the all content that would normally appear inside the $<$part$>$ tag.  hold the all content that would normally appear inside the $<$part$>$ tag.
 \begin{verbatim}  \begin{verbatim}
 <part id="11">  <part id="11">
 <randomlist show="1">    <randomlist show="1">
 <import id="12">sample1.library< /import>      <import id="12">sample1.library</import>
 <import id="13">sample2.library< /import>      <import id="13">sample2.library</import>
 <import id="14">sample3.library< /import>      <import id="14">sample3.library</import>
 < /randomlist>    </randomlist>
 < /part>  </part>
 <part id="15">  <part id="15">
 <randomlist show="1">    <randomlist show="1">
 <import id="16">sample4.library< /import>      <import id="16">sample4.library</import>
 <import id="17">sample5.library< /import>      <import id="17">sample5.library</import>
 <import id="18">sample6.library< /import>      <import id="18">sample6.library</import>
 < /randomlist>    </randomlist>
 < /part>  </part>
 \end{verbatim}  \end{verbatim}
   
 Note: when using $<$randomlist$>$ as shown above, all students will work  Note: when using $<$randomlist$>$ as shown above, all students will work

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>