Diff for /loncom/homework/randomlabel.pm between versions 1.33 and 1.34

version 1.33, 2002/08/02 18:20:48 version 1.34, 2002/08/07 21:49:35
Line 115  sub start_randomlabel { Line 115  sub start_randomlabel {
   
     }      }
     $bgimg=~s/\/$//;      $bgimg=~s/\/$//;
       my $dirtywidth=$texwidth+5;
     if ($texwidth==90) {      if ($texwidth==90) {
  $result.='\vspace*{2mm} \parbox{\textwidth}{  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.   $result.='\vspace*{2mm}\noindent \parbox{'.$dirtywidth.' mm}{  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.
     $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')';      $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')(0,-'.$texwidth*$h/$w.')';
     } else {      } else {
  $result.='\vspace*{2mm} \parbox{\textwidth}{  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.   $result.='\vspace*{2mm}\noindent \parbox{'.$dirtywidth.' mm}{  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.
     $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')('.(100-$texwidth).','.(100-$texwidth)*$h/$w.')';      $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')(0,-'.$texwidth*$h/$w.')';
     }      }
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result.=&Apache::edit::tag_start($target,$token);      $result.=&Apache::edit::tag_start($target,$token);
Line 156  sub end_randomlabel { Line 157  sub end_randomlabel {
     $result .= "</applet>\n<BR />";      $result .= "</applet>\n<BR />";
   } elsif ($target eq 'tex') {    } elsif ($target eq 'tex') {
       $result='\end{picture}\\\\}';        $result='\end{picture}\\\\}';
       if (@$parstack[-1]=~/\$texwidth\s*=\s*?"90/) { #"  
   @$parstack[-1]=~/\$height\s*=\s*?"(.+)?"/;    @$parstack[-1]=~/\$height\s*=\s*?"(.+)?"/;
   my $howtoskipback = $1/48;        my $one=$1;
   $result.=' \vskip -'.$howtoskipback.' cm ';    @$parstack[-1]=~/\$width\s*=\s*?"(.+)?"/;
       }        my $two=$1;
     @$parstack[-1]=~/\$texwidth\s*=\s*?"(.+)?"/;
         my $three=$1;
         my $howtoskipback = $three*$one/$two;
         $result.=' \vskip -'.$howtoskipback.' mm ';
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result.=&Apache::edit::end_table;      $result.=&Apache::edit::end_table;
   }    }
Line 283  sub end_labelgroup { Line 287  sub end_labelgroup {
       my $y = $Apache::randomlabel::ycoord[$i];        my $y = $Apache::randomlabel::ycoord[$i];
       my $value = $Apache::randomlabel::value[$i];        my $value = $Apache::randomlabel::value[$i];
       #x latex coordinate        #x latex coordinate
       my $tcX=($x-5)*($texwidth/$wwidth);        my $tcX=($x)*($texwidth/$wwidth);
       #y latex coordinate        #y latex coordinate
       my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );  #      my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
       my $tcY=$TY1-$y*($TY1/$wheight)+$texwidth*$ratio;        my $tcY=$TY1-$y*($TY1/$wheight);
       $tcX=sprintf('%.2f',$tcX);        $tcX=sprintf('%.2f',$tcX);
       $tcY=sprintf('%.2f',$tcY);        $tcY=sprintf('%.2f',$tcY);
       $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";        $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";

Removed from v.1.33  
changed lines
  Added in v.1.34


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>