# Difference between revisions of "TextbookSpecificMessages"

Line 83: | Line 83: | ||

− | <p> |
||

<p> |
<p> |
||

Now we show how to put a message inside of an existing BEGIN_TEXT/END_TEXT block. |
Now we show how to put a message inside of an existing BEGIN_TEXT/END_TEXT block. |
||

− | </p> |
||

</p> |
</p> |
||

## Revision as of 11:25, 10 August 2010

## Textbook specific messages: PG Code Snippet

*This code snippet shows the essential PG code to include textbook specific messages in a problem.
Note that these are insertions, not a complete PG file. This code will have to be incorporated
into the problem file on which you are working.*

You may want to include a message in your problem that tells students to look at a specific textbook. Or you may want to have different messages for different text books. In either case the message(s) are only meaningful to students using the specific textbook. But you also want your problem to be usable in a course using a different test book.

This code snippet explains how to set up a course and write the problem so that if the specific textbook is being used in the course, students will see the message for that textbook but if the textbook is not being used in the course, students will not see the message.

First you have add a line to the course.conf file which will activate the messages when viewed by
students in the course. Here is the line to add for a make believe textbook

`$pg{specialPGEnvironmentVars}{Pizer_Calculus_5th} = 1;`

If this line is not present, none of the messages below will appear when the problem is viewed.

First we show how to put a message in it's own BEGIN_TEXT/END_TEXT block.

PG problem file | Explanation |
---|---|

# The message below is only meaningful if you # are using the textbook "Calculus 5th ed" by Pizer. # If you are using this textbook, put the following # line (without the #) in the course.conf file: # $pg{specialPGEnvironmentVars}{Pizer_Calculus_5th} = 1; # Then your students will see the message but others, # not using this text (and not having the above line # in their course's course.conf file), can still use # this problem and their students will not see the message. |
We add a comment to the code of the problem explaining how textbook specific messages work. |

if (defined $envir{'Pizer_Calculus_5th'} and $envir{'Pizer_Calculus_5th'}) { BEGIN_TEXT This is similar to Problems 29 and 31 of Section 5.2 of Calculus 5th ed by Pizer. END_TEXT }; |
We check if the enviromental variable 'Pizer_Calculus_5th' is defined and true, and if so we out put the message. |

Now we show how to put a message inside of an existing BEGIN_TEXT/END_TEXT block.

PG problem file | Explanation |
---|---|

BEGIN_TEXT Let \[ f(x) = \tan^{-1}($b^x) \] $PAR \( f'( x ) = \) \{ans_rule(40) \} $PAR Here is how to put some text, e.g. \{if (defined $envir{'Pizer_Calculus_5th'} and $envir{'Pizer_Calculus_5th'}) { "This is similar to Problems 29 and 31 of Section 5.2 of Calculus 5th ed by Pizer, "} \} in the middle of a BEGIN_TEXT/END_TEXT block. END_TEXT |
Here we use the |