WeBWorK Problems

Issue printing complicated table to PDF

Issue printing complicated table to PDF

by Genevieve Toutain -
Number of replies: 0
Hi all, 

I am working on authoring some new webwork questions, and I pulled some shenanigans to set up a table as I'd like.  Here's how the table appears:
15258904511_37e089a66d.jpg

The question displays correctly and correctly checks answers, but the issue occurs when I try to print it.  I get the following error:

First error in TeX log is:
! Paragraph ended before \centerline was complete.
<to be read again>
                   \par
l.502 \hfil \par
                \medskip\centerline{\kern 1pt\vbox{\halign{#\hfil&&\kern 1em...
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

DOCUMENT();

loadMacros(
   "PGstandard.pl",     # Standard macros for PG language
   "PGcourse.pl",      # Customization file for the course
    "MathObjects.pl",
"unionTables.pl",
);


TEXT(beginproblem());



##############################################################
#
#  Setup



$a = Real(random(-10,10,.1));
$b = Real(random(-10,10,.1));
$c = Real(random(-10,10,.1));
$d = Real(random(-10,10,.1));
$e = Real(random(-10,10,.1));

$k = Real(random(-5,5,.1));

##############################################################
#
#  Text
#
#


BEGIN_TEXT


Suppose that the quantities whose values are represented by \(p\) and \(n\) are related by a constant rate of change of \(n\) with respect to \(p\).  Complete the following table.



$PAR

\{
BeginTable(border=>0, tex_border=>"0pt", spacing=>0, padding=>0, indent=>0).
AlignedRow(
[
BeginTable(border=>1, tex_border=>"1pt", spacing=>0, padding=>7, indent=>0).
AlignedRow([" \( \Delta p \) "], align=>CENTER, separation=>0 ).
AlignedRow([""], separation=>0).
AlignedRow([ "$a" ], separation=>0).
AlignedRow([  ans_rule(10)   ], separation=>0).
AlignedRow([ ans_rule(10)  ], separation=>0).
AlignedRow([""], separation=>0).
EndTable(),
BeginTable(border =>1, tex_border=>"1pt",  spacing=>0, padding=>8, indent=>0).
AlignedRow([" \( p \) "," \( n \) "], align=>CENTER, separation=>0 ).
AlignedRow([ ans_rule(10) ,"$e" ], separation=>0 ).
AlignedRow([ Real($d+$a) ,ans_rule(10)  ], separation=>0 ).
AlignedRow([ ans_rule(10) ,Real($e + $k*($a+$b)) ], separation=>0 ).
AlignedRow([ ans_rule(10) ,Real($e+ $k*($a+$b+$c)) ], separation=>0 ).
EndTable(),
BeginTable(border=>1, tex_border=>"1pt", spacing=>0, padding=>7, indent=>0).
AlignedRow([" \( \Delta n \)"], align=>CENTER, separation=>0 ).
AlignedRow([""], separation=>0).
AlignedRow([Real($a*$k)], separation=>0).
AlignedRow([ans_rule(10) ], separation=>0).
AlignedRow([ans_rule(10) ], separation=>0).
AlignedRow([""], separation=>0).
EndTable()
]
, separation=>0).
EndTable()
 \}





END_TEXT


##############################################################
#
#  Answers
#
#


\ANS( num_cmp( $b, tol=>.0000001 ) );
\ANS( num_cmp( $c, tol=>.0000001 ) );
\ANS( num_cmp( $d, tol=>.0000001 ) );
\ANS( num_cmp(  $e+$a*$k , tol=>.0000001 ) );
\ANS( num_cmp(  $d+$a+$b , tol=>.0000001 ) );
\ANS( num_cmp(  $d+$a+$b+$c, tol=>.0000001 ) );
\ANS( num_cmp(  $b*$k , tol=>.0000001 ) );
\ANS( num_cmp(  $c*$k , tol=>.0000001 ) );


ENDDOCUMENT();