## WeBWorK Problems

### BEGIN_TITLE Problem with Union Problem Library

by Thomas Hagedorn -
Number of replies: 2
We just installed Webwork 2.3.2 and are looking to upgrade our existing linear algebra problems using the new parser functions. Our first step was to look at Davide's examples from last year's Mathfest talk. We've installed the union_problib library and setup the following problem from his talk, but we're getting an error (we also get it in the old Webwork 2.1). Any idea what the problem might be?

Thanks,
Tom

### Error messages

Undefined subroutine &main::BEGIN_TITLE called at line 13 of [TMPL]/karen/cervone3.pg

### Error details

 Problem1
ERROR caught by Translator while processing problem file:karen/cervone3.pg
****************
Undefined subroutine &main::BEGIN_TITLE called at line 13 of [TMPL]/karen/cervone3.pg

****************

1 DOCUMENT(); # This should be the first executable line in the problem.
2
4 "PGstandard.pl",
5 "PGunion.pl",
6 "PGcourse.pl"
7 );
8
9 TEXT(beginproblem());
10
11 ######################################################################
12
14
15 $useOldAnswerMacros = 1; 16 17 BEGIN_PROBLEM(); 18 19 ############################## 20 # 21 # Setup 22 # 23 24$a = non_zero_random(-5,5,1);
25
26 ##############################
27 #
28 # Main text
29 #
30
31 BEGIN_TEXT
32 Consider the function $$f(t)=\left<t^2,1+t,3t+\cos(\pi t)\right>$$.$PAR 33 Then $$f'(t)$$ = $$\langle$$ \{ans_rule(15)\}, \{ans_rule(15)\}, \{ans_rule(15)\} $$\rangle$$$BR
34 and $$f'(a)$$ = $$\langle$$ \{ans_rule(15)\}, \{ans_rule(15)\}, \{ans_rule(15)\} $$\rangle$$.
35 $PAR 36 The tangent line to the graph of $$f$$ at $$t=a$$ is given 37 parametrically by:$BR
38 $$L(t)$$ = $$\langle$$ \{ans_rule(15)\}, \{ans_rule(15)\}, \{ans_rule(15)\} $$\rangle$$.
39 END_TEXT
40
41 ##############################
42 #
44 #
45
46 ($px,$py,$pz) = ($a**2,1+$a,3*$a+cos($PI*$a));
47 ($vx,$vy,$vz) = (2*$a,1,3-$PI*sin($PI*$a)); 48 49 ANS(fun_cmp(["2t","1","3 - pi sin(pi t)"],var=>"t")); 50 ANS(num_cmp([$px,$py,$pz]));
51
52 ANS(fun_cmp(["$px+$vx*t","$py+$vy*t","$pz+$vz*t"],var=>"t"));
53
54 ##############################
55
56 END_PROBLEM();
57 END_TITLE();
58
59 ######################################################################
60
61 ENDDOCUMENT(); # This should be the last executable line in the problem.

### Re: BEGIN_TITLE Problem with Union Problem Library

by Michael Gage -
Try adding this to a course customizing file PGcourse.pl at

courseName/templates/macros/PGcourse.pl
##################################

#
# Do course-specific problem initialization here (e.g., override
# values in PGunion.pl).
#

# "source.pl",
# "unionProblem.pl"

); # for the 'Show Problem Source' button

sub BEGIN_TITLE {
my $title = shift; TEXT(MODES(HTML=>'  ', TeX=>'')); Title($title); } sub END_TITLE { TEXT(MODES(HTML=>"
", TeX=>''));
}
##################################

You also need to make sure that in global.conf you have
listed ..../union_problib/macros as one of the places
where macro files are searched for -- but I think you have

This demonstration course requires more custom additions
than a standard course -- you still will not be able to
get the "see the source" button to work -- that takes the addition of a couple more custom files -- you can email me if you need this feature.

### Re: BEGIN_TITLE Problem with Union Problem Library

by Davide Cervone -
You can do as Mike suggests (which provides a definition for BEGIN_TITLE and END_TITLE), or you could just edit these out completely, as they are there only because I was using the WeBWorK set as my actual slides for the talk. This gave me the ability to give the "pages" a title so they presented nicely, but that is not really necessary (or really desirable) for the problem itself.

Note also that this particular problem does NOT use the new MathObjects (the new name for "Parser objects").

Mike points out that there are other macro files needed for implementing the "show source" buttons and such. You can actually get them from the slide for my talk because when you show source on a problem file, the various macro files are linked so that you can get to them as well. For example, you could access my PGcourse.pl file that way, as well as the slides.pl, source.pl and url.pl files that my slides used.