[LON-CAPA-cvs] cvs: loncom /homework matchresponse.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Apr 2004 17:58:16 -0000
sakharuk Fri Apr 2 12:58:16 2004 EDT
Modified files:
/loncom/homework matchresponse.pm
Log:
Bug 2847 (matchresponse printing location="right" spills into column 2) is fixed. In addition I readjusted the list enironment for the description list which allows to save space.
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.38 loncom/homework/matchresponse.pm:1.39
--- loncom/homework/matchresponse.pm:1.38 Mon Mar 15 17:09:52 2004
+++ loncom/homework/matchresponse.pm Fri Apr 2 12:58:16 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Full matching style response
#
-# $Id: matchresponse.pm,v 1.38 2004/03/15 22:09:52 albertel Exp $
+# $Id: matchresponse.pm,v 1.39 2004/04/02 17:58:16 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -153,7 +153,7 @@
$table.='</table>';
$Apache::matchresponse::itemtable{'display'}=$table;
} elsif ($target eq 'tex') {
- my $table=' \begin{description} ';
+ my $table=' \begin{description}\setlength{\leftmargin}{2em}\setlength{\labelwidth}{1em}\setlength{\itemsep}{0.5pt plus1pt minus2pt}\setlength{\listparindent}{0em} ';
my $i=0;
foreach my $name (@names) {
$Apache::response::itemgroup{$name.'.text'}=~s/\$\$/\$/g;
@@ -487,14 +487,22 @@
$result='<table><tr><td>'.$question.'</td><td>'.$result.
'</td></tr></table>';
} else {
- $result='\begin{tabular}{p{\textwidth/2}p{\textwidth/2}}\begin{minipage}{\textwidth/2}'.$question.'\end{minipage}&\begin{minipage}{\textwidth/2}'.$result.'\end{minipage}\end{tabular}';
+ my $tabsize=&Apache::londefdef::recalc($ENV{'form.textwidth'});
+ $tabsize=~/(\d+\.?\d*)/;
+ $tabsize=$1/2.1;
+ $tabsize.=' mm ';
+ $result='\setlength{\tabcolsep}{1 mm}\begin{tabular}{p{'.$tabsize.'}p{'.$tabsize.'}}\begin{minipage}{'.$tabsize.'}'.$question.'\end{minipage}&\begin{minipage}{'.$tabsize.'}'.$result.'\end{minipage}\end{tabular}';
}
} elsif ($result=&itemdisplay('left')) {
if ($target ne 'tex') {
$result='<table><tr><td>'.$result.'</td><td>'.$question.
'</td></tr></table>';
} else {
- $result='\begin{tabular}{p{\textwidth/2}p{\textwidth/2}}\begin{minipage}{\textwidth/2}'.$result.'\end{minipage}&\begin{minipage}{\textwidth/2}'.$question.'\end{minipage}\end{tabular}';
+ my $tabsize=&Apache::londefdef::recalc($ENV{'form.textwidth'});
+ $tabsize=~/(\d+\.?\d*)/;
+ $tabsize=$1/2.1;
+ $tabsize.=' mm ';
+ $result='\setlength{\tabcolsep}{1 mm}\begin{tabular}{p{'.$tabsize.'}p{'.$tabsize.'}}\begin{minipage}{'.$tabsize.'}'.$result.'\end{minipage}&\begin{minipage}{'.$tabsize.'}'.$question.'\end{minipage}\end{tabular}';
}
}
if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}