version 1.353, 2007/01/22 11:28:08
|
version 1.355, 2007/02/27 23:44:53
|
Line 1227 sub start_br {
|
Line 1227 sub start_br {
|
} |
} |
if ($signal eq 1) { |
if ($signal eq 1) { |
$currentstring .= ' \vskip 0 mm '; |
$currentstring .= ' \vskip 0 mm '; |
} elsif ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { |
} else { |
$currentstring .= '\strut \\\\ \strut '; |
$currentstring .= '\strut \\\\ \strut '; |
} else { # Honor break in simple <sup></sup> |
|
$currentstring .= '}} \strut \\\\ \strut \ensuremath{^{'; |
|
} |
} |
|
|
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1413 sub start_sub {
|
Line 1412 sub start_sub {
|
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring .= $token->[4]; |
$currentstring .= $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring .= '\ensuremath{_{'; |
$currentstring .= '\raisebox{-\smallskipamount}{\scriptsize{'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1436 sub start_sup {
|
Line 1435 sub start_sup {
|
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring .= $token->[4]; |
$currentstring .= $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring .= '\ensuremath{^{'; |
$currentstring .= '\raisebox{\smallskipamount}{\scriptsize{'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1994 sub start_table {
|
Line 1993 sub start_table {
|
$Apache::londefdef::table[-1]{'minlen'}=[]; |
$Apache::londefdef::table[-1]{'minlen'}=[]; |
$Apache::londefdef::table[-1]{'content'}=[]; |
$Apache::londefdef::table[-1]{'content'}=[]; |
$Apache::londefdef::table[-1]{'align'}=[]; |
$Apache::londefdef::table[-1]{'align'}=[]; |
if (&is_inside_of($tagstack, 'sup')) { |
|
$currentstring .= '}} \\\\ \ensuremath{^{ '; |
|
} |
|
if (&is_inside_of($tagstack, 'sub')) { |
|
$currentstring .= '}} \\\\ \ensuremath{_{ '; |
|
} |
|
$currentstring.=' \keephidden{NEW TABLE ENTRY}'; |
$currentstring.=' \keephidden{NEW TABLE ENTRY}'; |
|
|
|
|
Line 2879 sub start_img {
|
Line 2872 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 4357 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 4374 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 |