--- loncom/xml/londefdef.pm 2006/11/07 02:39:39 1.344 +++ loncom/xml/londefdef.pm 2007/01/08 19:09:23 1.350 @@ -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.350 2007/01/08 19:09:23 albertel 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 { @@ -2250,6 +2251,12 @@ sub end_table { } $have_rowspan++; $output .= '\multirow{'.$rowspan.'}[0]{*}{'; + + $Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ + s{^\s*\\par\s*}{}; + $Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ + s{\s*\\vskip\s*0pt\s*$}{}; + # # If we did not throw in a multicolumn to align, then add # an extra { @@ -2886,17 +2893,26 @@ sub start_img { } elsif ($align eq "left") { if ($latex_rendering eq "parpic") { $currentstring = '\parpic[l]{'.$currentstring.'}'; - } else { # wrapfig render - $currentstring = '\begin{wrapfigure}{l}{'.$width_param.'mm}' + } elsif ($latex_rendering eq "parbox") { + $currentstring = '\begin{minipage}[l]{'.$width_param.'mm}' + .$currentstring.'\end{minipage}'; + } elsif ($latex_rendering eq "wrapfigure" + || $latex_rendering ne 'none') { # wrapfig render + $currentstring = + '\begin{wrapfigure}{l}{'.$width_param.'mm}' .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; } } elsif ($align eq "right") { if ($latex_rendering eq "parpic") { $currentstring = '\parpic[r]{'.$currentstring.'}'; - } else { # wrapfig rendering - $currentstring = '\begin{wrapfigure}{r}{'.$width_param.'mm}' + } elsif ($latex_rendering eq "parbox") { + $currentstring = '\begin{minipage}[r]{'.$width_param.'mm}' + .$currentstring.'\end{minipage}'; + } elsif ($latex_rendering eq "wrapfigure" + || $latex_rendering ne 'none') { # wrapfig render + $currentstring = + '\begin{wrapfigure}{r}{'.$width_param.'mm}' .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; - } } else { # Bottom is also default. # $currentstring = '\raisebox{'.$height_param.'mm}{'.$currentstring.'}'; @@ -2928,7 +2944,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); + ['', 'none','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 +4314,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.'} ';