version 1.353, 2007/01/22 11:28:08
|
version 1.354, 2007/02/01 10:49:27
|
Line 2879 sub start_img {
|
Line 2879 sub start_img {
|
$size=~s/,$/]/; |
$size=~s/,$/]/; |
$currentstring .= '\graphicspath{{'.$path.'}}' |
$currentstring .= '\graphicspath{{'.$path.'}}' |
.'\includegraphics'.$size.'{'.$file.'} '; |
.'\includegraphics'.$size.'{'.$file.'} '; |
$currentstring = &align_latex_image($align, $latex_rendering, |
my $closure; |
$currentstring, |
($currentstring, $closure) = &align_latex_image($align, |
$width_param, $height_param); |
$latex_rendering, |
|
$currentstring, |
|
$width_param, |
|
$height_param); |
|
$currentstring .= $closure; |
|
|
} else { |
} else { |
&Apache::lonxml::debug("$src does not exist"); |
&Apache::lonxml::debug("$src does not exist"); |
Line 4360 sub LATEX_length {
|
Line 4364 sub LATEX_length {
|
# latex_rendering - rendering hint for latex. |
# latex_rendering - rendering hint for latex. |
# image - The LaTeX needed to insert the image itsef. |
# image - The LaTeX needed to insert the image itsef. |
# width,height - dimensions of the image. |
# width,height - dimensions of the image. |
|
# Returns: |
|
# The 1/2 wrapped image and the stuff required to close the |
|
# wrappage. This allows e.g. randomlabel to insert more stuff |
|
# into the closure. |
# |
# |
sub align_latex_image { |
sub align_latex_image { |
my ($align, $latex_rendering, $image, $width, $height) = @_; |
my ($align, $latex_rendering, $image, $width, $height) = @_; |
my $currentstring; # The result. |
my $currentstring; # The 1/2 wrapped image. |
|
my $closure; # The closure of the wrappage. |
# 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 |
# value of the latex specfication. The default is parbox, |
# value of the latex specfication. The default is parbox, |
Line 4373 sub align_latex_image {
|
Line 4381 sub align_latex_image {
|
# Even though we set a default alignment value, the user |
# Even though we set a default alignment value, the user |
# could have given us an illegal value. In that case we |
# could have given us an illegal value. In that case we |
# just use the default alignment of bottom.. |
# just use the default alignment of bottom.. |
|
$currentstring = "\n% figurewrapping \n"; |
if ($align eq "top") { |
if ($align eq "top") { |
$currentstring = '\raisebox{-'.$height.'mm}{'.$image.'}'; |
$currentstring .= '\raisebox{-'.$height.'mm}{'.$image; |
|
$closure = '}'; |
} elsif (($align eq "center") || ($align eq "middle")) { # Being kind |
} elsif (($align eq "center") || ($align eq "middle")) { # Being kind |
my $offset = $height/2; |
my $offset = $height/2; |
$currentstring = '\raisebox{-'.$offset.'mm}{'.$image.'}'; |
$currentstring .= '\raisebox{-'.$offset.'mm}{'.$image; |
|
$closure = '}'; |
} elsif ($align eq "left") { |
} elsif ($align eq "left") { |
if ($latex_rendering eq "parpic") { |
if ($latex_rendering eq "parpic") { |
$currentstring = '\parpic[l]{'.$image.'}'; |
$currentstring .= '\parpic[l]{'.$image; |
|
$closure = '}'; |
} elsif ($latex_rendering eq "parbox") { |
} elsif ($latex_rendering eq "parbox") { |
$currentstring = '\begin{minipage}[l]{'.$width.'mm}' |
$currentstring .= '\begin{minipage}[l]{'.$width.'mm}' |
.$image.'\end{minipage}'; |
.$image; |
|
$closure = '\end{minipage}'; |
} elsif ($latex_rendering eq "wrapfigure" |
} elsif ($latex_rendering eq "wrapfigure" |
|| $latex_rendering ne 'none') { # wrapfig render |
|| $latex_rendering ne 'none') { # wrapfig render |
$currentstring = |
$currentstring .= |
'\begin{wrapfigure}{l}{'.$width.'mm}' |
'\begin{wrapfigure}{l}{'.$width.'mm}' |
.'\scalebox{1.0}{'.$image.'}\end{wrapfigure}'; |
.'\scalebox{1.0}{'.$image; |
|
$closure = '}\end{wrapfigure}'; |
} |
} |
} elsif ($align eq "right") { |
} elsif ($align eq "right") { |
if ($latex_rendering eq "parpic") { |
if ($latex_rendering eq "parpic") { |
$currentstring = '\parpic[r]{'.$image.'}'; |
$currentstring .= '\parpic[r]{'.$image; |
|
$closure = '}'; |
} elsif ($latex_rendering eq "parbox") { |
} elsif ($latex_rendering eq "parbox") { |
$currentstring = '\begin{minipage}[r]{'.$width.'mm}' |
$currentstring .= '\begin{minipage}[r]{'.$width.'mm}' |
.$image.'\end{minipage}'; |
.$image; |
|
$closure = '\end{minipage}'; |
} elsif ($latex_rendering eq "wrapfigure" |
} elsif ($latex_rendering eq "wrapfigure" |
|| $latex_rendering ne 'none') { # wrapfig render |
|| $latex_rendering ne 'none') { # wrapfig render |
$currentstring = |
$currentstring .= |
'\begin{wrapfigure}{r}{'.$width.'mm}' |
'\begin{wrapfigure}{r}{'.$width.'mm}' |
.'\scalebox{1.0}{'.$image.'}\end{wrapfigure}'; |
.'\scalebox{1.0}{'.$image; |
|
$closure = '}\end{wrapfigure}'; |
} |
} |
} else { # Bottom is also default. |
} else { # Bottom is also default. |
# $currentstring = '\raisebox{'.$height.'mm}{'.$image.'}'; |
# $currentstring = '\raisebox{'.$height.'mm}{'.$image.'}'; |
$currentstring = $image; |
$currentstring .= "{$image"; |
|
$closure = '}'; |
} |
} |
return $currentstring; |
$currentstring .= "\n% end wrappage\n"; |
|
$closure = "\n% Begin closure\n".$closure."\n% End closure\n"; |
|
return ($currentstring, $closure); |
} |
} |
|
|
# is_inside_of $tagstack $tag |
# is_inside_of $tagstack $tag |