Diff for /loncom/xml/londefdef.pm between versions 1.264 and 1.266

version 1.264, 2005/03/16 21:35:17 version 1.266, 2005/04/06 06:09:42
Line 156  sub start_html { Line 156  sub start_html {
     if ($target eq 'web' || $target eq 'edit') {      if ($target eq 'web' || $target eq 'edit') {
  $currentstring = &Apache::lonxml::xmlbegin();   $currentstring = &Apache::lonxml::xmlbegin();
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  @Apache::londefdef::table = ();  
  $currentstring .= '\documentclass[letterpaper]{article}';   $currentstring .= '\documentclass[letterpaper]{article}';
  if (($ENV{'form.latex_type'}=~'batchmode') ||   if (($ENV{'form.latex_type'}=~'batchmode') ||
             (!$ENV{'request.role.adv'})) {$currentstring .='\batchmode';}               (!$ENV{'request.role.adv'})) {$currentstring .='\batchmode';} 
Line 2498  sub start_img { Line 2497  sub start_img {
  &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src");   &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src");
   
  #if original gif/jpg/png file exist do following:   #if original gif/jpg/png file exist do following:
    my $origsrc=$src;
  my ($path,$file) = &get_eps_image($src);   my ($path,$file) = &get_eps_image($src);
  $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);   $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
  &Apache::lonxml::debug("path = $path file = $file src = $src");   &Apache::lonxml::debug("path = $path file = $file src = $src");
  if (-e $src) {   if (-e $src) {
     &Apache::lonxml::debug("$src exists");      &Apache::lonxml::debug("$src exists");
     my ($height_param,$width_param)=      my ($height_param,$width_param)=
  &image_size($src,0.3,$parstack,$safeeval);   &image_size($origsrc,0.3,$parstack,$safeeval);
     my $destpath = $path;      my $destpath = $path;
     $destpath    =~ s/ /\_/g; # Spaces in path cause LaTex to vomit.      $destpath    =~ s/ /\_/g; # Spaces in path cause LaTex to vomit.
     my $destfile = $file;      my $destfile = $file;
     $destfile    =~ s/ /\_/g;      $destfile    =~ s/ /\_/g;
       my $size;
       if ($width_param)  { $size.='width='.$width_param.' mm,'; }
       if ($height_param) { $size.='height='.$height_param.' mm]'; }
       $size='['.$size;
       $size=~s/,$/]/; 
     $currentstring .= '\graphicspath{{'.$destpath.'}}'      $currentstring .= '\graphicspath{{'.$destpath.'}}'
  .'\includegraphics[width='.$width_param.' mm,height='.$height_param.'mm]{'.$destfile.'} ';   .'\includegraphics'.$size.'{'.$destfile.'} ';
   
     #    If there's an alignment specification we need to honor it here.      #    If there's an alignment specification we need to honor it here.
     #    For the horizontal alignments, we will also honor the      #    For the horizontal alignments, we will also honor the
Line 3796  sub image_size { Line 3801  sub image_size {
  } else {    } else { 
     $width_param = $TeXwidth;      $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) {      } elsif ($TeXheight) {
  $height_param = $TeXheight;   $height_param = $TeXheight;
  $width_param  = $TeXheight/$height_param*$width_param;   if ($height_param) {
       $width_param  = $TeXheight/$height_param*$width_param;
    }
     } elsif ($width) {      } elsif ($width) {
  my $old_width_param=$width_param;   my $old_width_param=$width_param;
  $width_param = $width*$scaling;   $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'}) {      if ($width_param > $ENV{'form.textwidth'}) {
         my $old_width_param=$width_param;          my $old_width_param=$width_param;
  $width_param =0.95*$ENV{'form.textwidth'};   $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);      return ($height_param, $width_param);
 }  }

Removed from v.1.264  
changed lines
  Added in v.1.266


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