[LON-CAPA-cvs] cvs: loncom(version_1_3_X) /xml londefdef.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 06 Apr 2005 06:08:14 -0000


matthew		Wed Apr  6 02:08:14 2005 EDT

  Modified files:              (Branch: version_1_3_X)
    /loncom/xml	londefdef.pm 
  Log:
  - try to prevent bobs during image printing (no more divide by zeroes)
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.255 loncom/xml/londefdef.pm:1.255.2.1
--- loncom/xml/londefdef.pm:1.255	Wed Feb  9 14:51:43 2005
+++ loncom/xml/londefdef.pm	Wed Apr  6 02:08:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.255 2005/02/09 19:51:43 albertel Exp $
+# $Id: londefdef.pm,v 1.255.2.1 2005/04/06 06:08:13 matthew Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2508,8 +2508,13 @@
 	    if (-e $newsrc) {
 		#eps counterpart for image exist 
 		if ($path) {
+		    my $size;
+		    if ($width_param)  { $size.='width='.$width_param.' mm,'; }
+		    if ($height_param) { $size.='height='.$height_param.' mm]'; }
+		    $size='['.$size;
+		    $size=~s/,$/]/; 
 		    $currentstring .= '\graphicspath{{'.$path.'}}'
-			             .'\includegraphics[width='.$width_param.' mm,height='.$height_param.'mm]{'.$file.'} ';
+			             .'\includegraphics'.$size.'{'.$file.'} ';
 		}
 	    } else {
 		#there is no eps counterpart for image - check for ps one
@@ -3800,19 +3805,29 @@
 	} else { 
 	    $width_param = $TeXwidth;
 	}
-	$height_param=$TeXwidth/$old_width_param*$height_param;
+	if ($TeXheight) {
+	    $height_param = $TeXheight;
+	} elsif ($old_width_param) {
+	    $height_param=$TeXwidth/$old_width_param*$height_param;
+	}
     } elsif ($TeXheight ne '') {
 	$height_param = $TeXheight;
-	$width_param  = $TeXheight/$height_param*$width_param;
+	if ($height_param) {
+	    $width_param  = $TeXheight/$height_param*$width_param;
+	}
     } elsif ($width ne '') {
 	my $old_width_param=$width_param;
 	$width_param = $width*$scaling;      
-        $height_param=$width_param/$old_width_param*$height_param;
+	if ($old_width_param) {
+            $height_param=$width_param/$old_width_param*$height_param;
+	}
     }
     if ($width_param > $ENV{'form.textwidth'}) {
         my $old_width_param=$width_param;
 	$width_param =0.95*$ENV{'form.textwidth'};
-        $height_param=$width_param/$old_width_param*$height_param;
+	if ($old_width_param) {
+            $height_param=$width_param/$old_width_param*$height_param;
+	}
     }
     return ($height_param, $width_param);
 }