Difference between revisions of "AnswerFormatHelp"

From WeBWorK_wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{historical}}
 
<h2>Answer Format Help Links</h2>
 
<h2>Answer Format Help Links</h2>
  +
  +
'''This macro has been deprecated as of WeBWorK 2.18'''
  +
  +
Although this will still function, new problems should not use this and will not be accepted in the OPL with this macro.
  +
  +
Instead, use the <pre>helpLink</pre> function.
   
 
<!-- Header for these sections -- no modification needed -->
 
<!-- Header for these sections -- no modification needed -->
Line 101: Line 108:
 
</p>
 
</p>
 
<p>
 
<p>
It is possible to provide a link to an external file. We do not recommend this as it requires external files be maintained and links not become broken. Fields marked bogus are unused, but necessary, placeholders.
+
It is possible to provide a link to an external help file using <code>\{ htmlLink("http://someplace.edu/help.html") \}</code>. We do not recommend this as it requires external files be maintained and links not become broken (especially when the server changes or moves). Instead of using a link to an external help file, use the method described at the bottom of this page.
<pre>
 
\{ AnswerFormatHelp("bogus","help (formulas)","http://webwork.someschool.edu/dir/subdir/") \}
 
</pre>
 
</p>
 
<p>
 
It is possible to write your help document directly into the PG file as the fourth field to <code>AnswerFormatHelp</code>. This keeps the help documentation internal to the PG file and is therefore preferable to providing a link to an external file.
 
<pre>
 
\{ AnswerFormatHelp("bogus",
 
"custom help on formulas (internal source)",
 
"bogus",
 
"<h3>&nbsp;&nbsp;Help With Something</h3>
 
<ul>
 
<li><font color='#222255'>Header 1:</font> Some text with
 
some math &nbsp;&nbsp; <code>ln(x)</code><br /><br /></li>
 
<li><font color='#222255'>Header 2:</font> Some more text
 
with stuff below indented <blockquote>More text</blockquote>
 
<br /></br></li>
 
</ul>
 
<br /><br />") \}
 
</pre>
 
 
</p>
 
</p>
 
</td>
 
</td>
Line 128: Line 135:
 
[[IndexOfProblemTechniques|Problem Techniques Index]]
 
[[IndexOfProblemTechniques|Problem Techniques Index]]
 
</p>
 
</p>
  +
  +
  +
<p>
  +
Instead of using a link to an external file, use the following:
  +
  +
<pre>
  +
HEADER_TEXT(<<END_HEADER_TEXT);
  +
<script type="text/javascript">
  +
<!--
  +
function openhelpCustom1() {
  +
OpenWindow=window.open("","answer_format_help","width=550,height=550,status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=1,scrollbars=1");
  +
OpenWindow.document.write("<title>Help With Something</title>")
  +
OpenWindow.document.write("<body bgcolor='#ffffff'>")
  +
OpenWindow.document.write("<center><h2>Help With Something</h2></center>")
  +
OpenWindow.document.write("<ul>")
  +
OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation &nbsp; <code>pi/3</code></blockquote></li>")
  +
OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation &nbsp; <code>pi/3</code></blockquote></li>")
  +
OpenWindow.document.write("</ul>")
  +
OpenWindow.document.write("</body>")
  +
OpenWindow.document.write("</html>")
  +
OpenWindow.document.close()
  +
self.name="main"
  +
if (window.focus) {OpenWindow.focus()}
  +
return false;
  +
}
  +
-->
  +
</script>
  +
END_HEADER_TEXT
  +
  +
  +
BEGIN_TEXT
  +
  +
\{ htmlLink("#","help (something)","onClick='openhelpCustom1()';") \}
  +
END_TEXT
  +
</pre>
  +
</p>
  +
   
 
[[Category:Problem Techniques]]
 
[[Category:Problem Techniques]]

Latest revision as of 16:51, 20 June 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

Answer Format Help Links

This macro has been deprecated as of WeBWorK 2.18

Although this will still function, new problems should not use this and will not be accepted in the OPL with this macro.

Instead, use the

helpLink

function.


This PG code shows how to add answer format help links to problems.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
"parserImplicitPlane.pl",
);
TEXT(beginproblem());

Initialization: We need to include the macros file AnswerFormatHelp.pl.

Context("ImplicitPlane")->variables->are(x=>"Real",y=>"Real");

$answer = ImplicitPlane("x+y=2");

Setup: By declaring there are only two variables, ImplicitPlane will address objects as lines rather than planes.

BEGIN_TEXT
Enter an equation for a line through the points
\( (0,2) \) and \( (2,0) \).
$BR
$BR
\{ ans_rule(20) \}
\{ AnswerFormatHelp("equations") \}
END_TEXT

Main Text: We use AnswerFormatHelp("equations") to generate a link to an html help file with link text help (equations). The html help files are specifically designed to help students figure out the correct syntax for their answer, as well as common mistakes to avoid. We recommend placing a help link immediately after each answer blank in a problem, especially if there are different types of answers. Currently, help files are available for

  • angles
  • decimals
  • exponents
  • formulas
  • fractions
  • inequalities
  • intervals
  • logarithms
  • limits
  • numbers
  • points
  • syntax
  • units
  • vectors

It is possible to change the link text to help entering equations by including a second argument to the routine:

\{ AnswerFormatHelp("equations","help entering equations") \}

It is possible to provide a link to an external help file using \{ htmlLink("http://someplace.edu/help.html") \}. We do not recommend this as it requires external files be maintained and links not become broken (especially when the server changes or moves). Instead of using a link to an external help file, use the method described at the bottom of this page.

$showPartialCorrectAnswers = 1;

ANS( $answer->cmp() );

ENDDOCUMENT();

Answer Evaluation:

Problem Techniques Index


Instead of using a link to an external file, use the following:

HEADER_TEXT(<<END_HEADER_TEXT);
<script type="text/javascript">
<!--
function openhelpCustom1() {
OpenWindow=window.open("","answer_format_help","width=550,height=550,status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=1,scrollbars=1");
OpenWindow.document.write("<title>Help With Something</title>")
OpenWindow.document.write("<body bgcolor='#ffffff'>")
OpenWindow.document.write("<center><h2>Help With Something</h2></center>")
OpenWindow.document.write("<ul>")
OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation   <code>pi/3</code></blockquote></li>")
OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation   <code>pi/3</code></blockquote></li>")
OpenWindow.document.write("</ul>")
OpenWindow.document.write("</body>")
OpenWindow.document.write("</html>")
OpenWindow.document.close()
self.name="main"
if (window.focus) {OpenWindow.focus()}
return false;
}
-->
</script>
END_HEADER_TEXT


BEGIN_TEXT

\{ htmlLink("#","help (something)","onClick='openhelpCustom1()';") \}
END_TEXT