--- loncom/xml/londefdef.pm 2006/09/25 10:11:47 1.338 +++ loncom/xml/londefdef.pm 2006/11/06 23:45:00 1.343 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.338 2006/09/25 10:11:47 foxr Exp $ +# $Id: londefdef.pm,v 1.343 2006/11/06 23:45:00 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -1991,7 +1991,13 @@ sub start_table { $Apache::londefdef::table[-1]{'minlen'}=[]; $Apache::londefdef::table[-1]{'content'}=[]; $Apache::londefdef::table[-1]{'align'}=[]; - $currentstring.='\keephidden{NEW TABLE ENTRY}'; + if (&is_inside_of($tagstack, 'sup')) { + $currentstring .= '}} \\\\ \ensuremath{^{ '; + } + if (&is_inside_of($tagstack, 'sub')) { + $currentstring .= '}} \\\\ \ensuremath{_{ '; + } + $currentstring.=' \keephidden{NEW TABLE ENTRY}'; } @@ -2846,6 +2852,7 @@ sub start_img { #if original gif/jpg/png file exist do following: my $origsrc=$src; my ($path,$file) = &get_eps_image($src); + # &Apache::lonnet::logthis("Image source: $src result: $path $file"); $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); &Apache::lonxml::debug("path = $path file = $file src = $src"); if (-e $src) { @@ -2853,12 +2860,14 @@ sub start_img { my ($height_param,$width_param)= &image_size($origsrc,0.3,$parstack,$safeeval); my $destpath = $path; - $destpath =~ s/ /\_/g; # Spaces in path cause LaTex to vomit. my $destfile = $file; - $destfile =~ s/ /\_/g; my $size; if ($width_param) { $size.='width='.$width_param.' mm,'; } if ($height_param) { $size.='height='.$height_param.' mm]'; } + # Default size if not able to extract that (e.g. eps image). + + # &Apache::lonnet::logthis("Size = $size"); + $size='['.$size; $size=~s/,$/]/; $currentstring .= '\graphicspath{{'.$destpath.'}}' @@ -3414,6 +3423,9 @@ sub start_blockquote { if ($target eq 'web' || $target eq 'webgrade') { $currentstring .= $token->[4]; } + if ($target eq 'tex') { + $currentstring .= '\begin{quote}'; + } return $currentstring; } @@ -3423,6 +3435,9 @@ sub end_blockquote { if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[2]; } + if ($target eq 'tex') { + $currentstring = '\end{quote}'; + } return $currentstring; } @@ -4255,10 +4270,25 @@ sub get_eps_image { if ($sext ne "") { # Put the ext. back in to uniquify. $src =~ s/\.eps$/$sext.eps/; } + } + } + } else { + # If the postscript file has spaces in its name, + # LaTeX will gratuitiously vomit. Therefore + # queue such files for copy with " " replaced by "_". + # printout.pm will know them by their .ps or .eps extensions. + my $newsrc = $orig_src; + $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|; + open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"); + print FILE "$src\n"; + close FILE; + $src=~s|/home/httpd/html/res|/home/httpd/prtspool|; + $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; } my ($path,$file)=($src=~m|(.*)/([^/]*)$|); + $file =~ s/ /\_/g; &Apache::lonxml::debug("get_eps_image returning: $path / $file
"); return ($path.'/',$file); }