--- loncom/xml/londefdef.pm 2006/11/07 02:39:39 1.344 +++ loncom/xml/londefdef.pm 2006/12/18 11:17:46 1.347 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.344 2006/11/07 02:39:39 albertel Exp $ +# $Id: londefdef.pm,v 1.347 2006/12/18 11:17:46 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -48,6 +48,7 @@ use Apache::lonmenu(); use Apache::lonmeta(); use Apache::Constants qw(:common); use File::Basename; +use LONCAPA(); # use Data::Dumper; BEGIN { @@ -2886,6 +2887,9 @@ sub start_img { } elsif ($align eq "left") { if ($latex_rendering eq "parpic") { $currentstring = '\parpic[l]{'.$currentstring.'}'; + } elsif ($latex_rendering eq "parbox") { + $currentstring = '\begin{minipage}[l]{'.$width_param.'mm}' + .$currentstring.'\end{minipage}'; } else { # wrapfig render $currentstring = '\begin{wrapfigure}{l}{'.$width_param.'mm}' .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; @@ -2893,6 +2897,9 @@ sub start_img { } elsif ($align eq "right") { if ($latex_rendering eq "parpic") { $currentstring = '\parpic[r]{'.$currentstring.'}'; + } elsif ($latex_rendering eq "parbox") { + $currentstring = '\begin{minipage}[r]{'.$width_param.'mm}' + .$currentstring.'\end{minipage}'; } else { # wrapfig rendering $currentstring = '\begin{wrapfigure}{r}{'.$width_param.'mm}' .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; @@ -2928,7 +2935,7 @@ sub start_img { $currentstring .=&Apache::edit::select_arg('Alignment:','align', ['','bottom','middle','top','left','right'],$token,5); $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap', - ['', 'parbox', 'parpic'], $token, 2); + ['', 'parbox', 'parpic', 'wrapfigure'], $token, 2); $currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl', ['no','yes'], $token, 2); $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); @@ -4298,15 +4305,15 @@ sub eps_generation { print $temp_file "$src\n"; my $newsrc = $src; $newsrc =~ s/(\.gif|\.jpg|\.jpeg)$/\.eps/i; - $newsrc=~s/\/home\/httpd\/html\/res//; - $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//; - $newsrc=~s/\/\.\//\//; - $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//; - if ($newsrc=~/\/home\/httpd\/lonUsers\//) { - $newsrc=~s/\/home\/httpd\/lonUsers//; - $newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//; + $newsrc=~s{/home/httpd/html/res}{}; + $newsrc=~s{/home/($LONCAPA::username_re)/public_html/}{/$1/}; + $newsrc=~s{/\./}{/}; + $newsrc=~s{/([^/]+)\.(ps|eps)}{/}; + if ($newsrc=~m{/home/httpd/lonUsers/}) { + $newsrc=~s{/home/httpd/lonUsers}{}; + $newsrc=~s{/($LONCAPA::domain_re)/./././}{/$1/}; } - if ($newsrc=~/\/userfiles\//) { + if ($newsrc=~m{/userfiles/}) { return ' \graphicspath{{'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; } else { return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';