Forum archive 2000-2006

Arnold K. Pizer - Using italic in pg problems

Arnold K. Pizer - Using italic in pg problems

by Arnold Pizer -
Number of replies: 0
inactiveTopicUsing italic in pg problems topic started 10/28/2005; 11:54:09 AM
last post 10/28/2005; 12:02:16 PM
userArnold K. Pizer - Using italic in pg problems  blueArrow
10/28/2005; 11:54:09 AM (reads: 437, responses: 2)
The University of Utah recently switched form LaTeX2html to dvipng for processing images in pg problems. This has raised the following issue communicated by Peter Alfeld:

Arnie,

We did follow your advice and switched to png. It works, with the execption of one minor glitch. The "images" mode ignores LaTeX constructs like {it italic text} in the *.pg files. In the browser that instruction would show up as ordinary text as in this message. Of course, the problem goes away if we replace that text with italic text. But we have hundreds of problems here that we have written and that involve the LaTeX construction. It's a little daunting to convert all those files without introducing new errors. Do you have any recommendations in this context? Thanks again for taking the time to respond to inquires like this!

Peter

<| Post or View Comments |>


userArnold K. Pizer - Re: Using italic in pg problems  blueArrow
10/28/2005; 11:54:56 AM (reads: 540, responses: 0)
Hi Peter,

If the code is in math mode, e.g. \( \hbox {it italic text} \), it works (at least in my test) and in a pg problem all the LaTeX code should be in math mode. If you want italic elsewhere you should put it between $BITALIC and $EITALIC, e.g. $BITALIC italic text $EITALIC so that it works in any mode (html, pdf, etc).

It doesn't sound like your problems are written this way. Can you send me a sample? I don't remember exactly but maybe latex2html processed the whole problem so that things works that were not supposed to work. There are editors that allow you to make global changes in thousands of files at once (we have done this in the past to update pg problems) but obviously you have to be very careful, e.g. you want to keep {\it italic text} in math mode but change it to $BITALIC italic text $EITALIC outside of math mode.

Maybe Pieter (or some other expert) could write a perl script that would make the replacements in the correct places.

I'm going to post this on the WeBWorK Bulletin Board and maybe someone else has a suggestion.

Arnie

<| Post or View Comments |>


userArnold K. Pizer - Re: Using italic in pg problems  blueArrow
10/28/2005; 12:02:16 PM (reads: 564, responses: 0)
Arnie,

Thanks for checking into this. There won't be an issue when writing new problems, and I appreciate what you are saying about writing a script to convert files wholesale, or use a suitable editor. I've done that sort of stuff in the past and can do it again. But the project is a little open ended, and of course error prone and time consuming. When I first started writing ww problems I used LaTeX Constructions outside of math mode freely because l2h conversion handled it very well. By now I must have written probably close to a thousand. Below is an example file. There is a \bf statement that students need to get everything right, and the solution uses the LaTeX \item construction. If you look at that problem through ww in png mode you'll see the LaTeX control codes. In particular, look at the solution and the hint. Compare it with l2h mode, where it looks just fine. Thanks for posting the query. If it's a problem of general interest, and we do come up with some sort of script here, we'd of course be happy to make it generally available.

Peter

---------------------------------------------------------------------


 




##KEYWORDS('true-false')




DOCUMENT(); # This should be the first executable line in the problem.




loadMacros(
PG.pl,
PGbasicmacros.pl,
PGchoicemacros.pl,
PGanswermacros.pl,
PGauxiliaryFunctions.pl
);




install_problem_grader(~~&std_problem_grader);
TEXT(&beginproblem);
$showPartialCorrectAnswers = 0;
$showPartialCredit = 0;





TEXT(EV2(<<EOT));
Think about the following statements and indicate whether they are
true (T) of false (F).




$BR
{\bf You need to get all answers correct before obtaining credit.}




$BR \{ ans_rule(4) \} The graph of a linear polynomial is a straight
line.
$BR




EOT




&ANS(str_cmp("T"));




TEXT(EV2(<<EOT));
$BR \{ ans_rule(4) \} The degree of a trinomial is at least 2.
$BR




EOT




&ANS(str_cmp("T"));




TEXT(EV2(<<EOT));
$BR \{ ans_rule(4) \} The product of two polynomials is always a polynomial.
$BR




EOT




&ANS(str_cmp("T"));




TEXT(EV2(<<EOT));
$BR \{ ans_rule(4) \} The quotient of two polynomials is always a polynomial.
$BR




EOT




&ANS(str_cmp("F"));




TEXT(EV2(<<EOT));
$BR \{ ans_rule(4) \} The sum of two polynomials is always a polynomial.
$BR
EOT
&ANS(str_cmp("T"));




TEXT(EV2(<<EOT));
$BR \{ ans_rule(4) \} The difference of two polynomials is always a
polynomial.
$BR
EOT
&ANS(str_cmp("T"));




HINT(EV3(<<'EOT'));
$BR {\large\bf Hint:}
Look at an example. Try to prove the statement wrong by finding g an example
where it does not hold.
EOT




SOLUTION(EV3(<<'EOT'));
$BR {\large\bf Solution:}




\begin{itemize}
\item The graph of a linear polynomial is a straight line. { Yes!
Home work 5 and the associated material
discussed at great length the correspondence between linear functions
and their graphs.}




\item The degree of a trinomial is at least 2. { Yes, because with a
polynomial of degree less than 2 you can have at most 2 terms.}




\item The product of two polynomials is always a polynomial. { Yes.}




\item The quotient of two polynomials is always a polynomial. { No,
for example not in the case \[f(x) = \frac{x+1}{x+2}.\]}




\item The sum of two polynomials is always a polynomial. { Yes.}




\item The difference of two polynomials is always a polynomial. {
Yes. So you can add, subtract and multiply polynomials, and you'll
still have a polynomial. You cannot always divided them and still
have a polynomial.}




\end{itemize}



EOT




ENDDOCUMENT(); # This should be the last executable line in the
problem.

<| Post or View Comments |>