version 1.355, 2007/02/27 23:44:53
|
version 1.386, 2008/04/29 10:16:37
|
Line 128 sub start_m {
|
Line 128 sub start_m {
|
#&Apache::lonxml::debug("M is ends with:$currentstring:"); |
#&Apache::lonxml::debug("M is ends with:$currentstring:"); |
$Apache::lonxml::post_evaluate=0; |
$Apache::lonxml::post_evaluate=0; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
|
$currentstring = $inside; |
$currentstring = $inside; |
my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); |
my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); |
if ($eval eq 'on') { |
if ($eval eq 'on') { |
Line 135 sub start_m {
|
Line 136 sub start_m {
|
} |
} |
if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';} |
if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';} |
# detect simple math mode entry exits, and convert them |
# detect simple math mode entry exits, and convert them |
# to use \ensuremath |
# to use \ensuremath ... unless there's a \verb inside. |
if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) { |
if (! ($currentstring=~/\\verb/)) { |
$currentstring=~s/^(\s*)\$/$1/; |
if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) { |
$currentstring=~s/\$(\s*)$/$1/; |
$currentstring=~s/^(\s*)\$/$1/; |
$currentstring='\ensuremath{'.$currentstring.'}'; |
$currentstring=~s/\$(\s*)$/$1/; |
|
$currentstring='\ensuremath{'.$currentstring.'}'; |
|
} |
} |
} |
$Apache::lonxml::post_evaluate=0; |
$Apache::lonxml::post_evaluate=0; |
} |
} |
Line 197 sub start_html {
|
Line 200 sub start_html {
|
'\usepackage[dvips]{graphicx}'. |
'\usepackage[dvips]{graphicx}'. |
'\usepackage{wrapfig}'. |
'\usepackage{wrapfig}'. |
'\usepackage{picins}'. |
'\usepackage{picins}'. |
|
'\usepackage[T1]{fontenc}'."\n". |
|
'\usepacakge{ucs}'."\n". |
|
'\usepackage[utf8]{inputenc}'."\n". |
|
'\usepackage{latexsym}'."\n". |
'\usepackage{epsfig}'. |
'\usepackage{epsfig}'. |
'\usepackage{calc}'. |
'\usepackage{calc}'. |
'\usepackage{amsmath}'. |
'\usepackage{amsmath}'. |
Line 445 sub start_meta {
|
Line 452 sub start_meta {
|
if ((not defined $content) && (not defined $name)) { |
if ((not defined $content) && (not defined $name)) { |
&Apache::lonxml::startredirection(); |
&Apache::lonxml::startredirection(); |
} |
} |
|
} elsif ($target eq 'edit') { |
|
$currentstring .= &Apache::edit::tag_start($target,$token); |
|
$currentstring .= &Apache::edit::text_arg('Name:','name',$token,30); |
|
$currentstring .= &Apache::edit::text_arg('Content:','content',$token,70); |
|
$currentstring .= &Apache::edit::end_row(); |
|
} elsif ($target eq 'modified') { |
|
my $constructtag = |
|
&Apache::edit::get_new_args($token,$parstack,$safeeval, |
|
'name','content'); |
|
if ($constructtag) { $currentstring = &Apache::edit::rebuild_tag($token); } |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 468 sub end_meta {
|
Line 485 sub end_meta {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
sub insert_meta { |
|
return ' |
|
<meta />'; |
|
} |
|
|
# accessrule |
# accessrule |
sub start_accessrule { |
sub start_accessrule { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
my $eff=&Apache::lonxml::get_param |
my $eff =&Apache::lonxml::get_param('effect',$parstack,$safeeval,undef,1); |
('effect',$parstack,$safeeval,undef,1); |
my $realm=&Apache::lonxml::get_param('realm', $parstack,$safeeval,undef,1); |
my $realm=&Apache::lonxml::get_param |
my $role =&Apache::lonxml::get_param('role', $parstack,$safeeval,undef,1); |
('realm',$parstack,$safeeval,undef,1); |
my $type =&Apache::lonxml::get_param('type', $parstack,$safeeval,undef,1); |
my $role=&Apache::lonxml::get_param |
|
('role',$parstack,$safeeval,undef,1); |
my ($dom,$crs,$sec,$separator); |
$realm=~s/\s+//g; |
if ($type eq 'user') { |
$realm=~s/\//\_/g; |
($dom,$crs,$sec)=split(m{/},$realm); |
$realm=~s/^\_//; |
$crs = &LONCAPA::clean_username($crs); |
$realm=~s/\W/\;/g; |
$separator = '/'; |
$role=~s/\s+//g; |
} else { |
$role=~s/\//\_/g; |
($dom,$crs,$sec)=split(/\_/,$realm); |
$role=~s/\W/\;/g; |
$crs = &LONCAPA::clean_courseid($crs); |
|
$separator = '_'; |
|
} |
|
$dom = &LONCAPA::clean_domain($dom); |
|
|
|
$sec =~s/\W//; |
|
$realm = $dom; |
|
if ($crs =~ /\S/) { $realm .= $separator.$crs; } |
|
if ($sec =~ /\S/) { $realm .= $separator.$sec; } |
|
$role=~s/\W//g; |
|
|
if ($target eq 'web') { |
if ($target eq 'web') { |
my $args=''; |
my $args=''; |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
Line 495 sub start_accessrule {
|
Line 527 sub start_accessrule {
|
} |
} |
} |
} |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
$currentstring='<rule>'.$eff.':'.$realm.':'.$role.'</rule>'; |
$currentstring='<rule>'.$eff.':'.$realm.':'.$role.':'.$type.'</rule>'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 513 sub end_accessrule {
|
Line 545 sub end_accessrule {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
sub generate_css_links { |
|
my $links; |
|
my $css_href = &Apache::lonnet::EXT('resource.0.cssfile'); |
|
if ($css_href =~ /\S/) { |
|
&Apache::lonxml::extlink($css_href); |
|
$links .= |
|
'<link rel="stylesheet" type="text/css" href="'.$css_href.'" />'; |
|
} |
|
return $links; |
|
} |
|
|
#-- <body> tag (end tag required) |
#-- <body> tag (end tag required) |
sub start_body { |
sub start_body { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
Line 527 sub start_body {
|
Line 570 sub start_body {
|
if (&is_inside_of($tagstack, "head")) { |
if (&is_inside_of($tagstack, "head")) { |
&end_head(@_); |
&end_head(@_); |
} |
} |
|
|
|
my $extra_head = &generate_css_links(); |
|
|
$currentstring = |
$currentstring = |
&Apache::loncommon::start_page($Apache::londefdef::title, |
&Apache::loncommon::start_page($Apache::londefdef::title, |
$Apache::londefdef::head, |
$Apache::londefdef::head |
|
.$extra_head, |
{'add_entries' => $token->[2], |
{'add_entries' => $token->[2], |
'no_title' => 1, |
'no_title' => 1, |
'force_register' => 1}); |
'force_register' => 1}); |
|
|
if ($env{'request.state'} ne 'published') { |
if ($env{'request.state'} ne 'published') { |
$currentstring.=&Apache::lonmenu::constspaceform(); |
$currentstring.=&Apache::lonmenu::constspaceform(); |
$currentstring.=(<<EDITBUTTON); |
$currentstring.=&Apache::londefdef::edit_controls(); |
<form method="post"> |
|
<input type="submit" name="editmode" accesskey="e" value="Edit" /> |
|
</form> |
|
<br /> |
|
EDITBUTTON |
|
} |
} |
$currentstring.=&Apache::lonxml::message_location(); |
$currentstring.=&Apache::lonxml::message_location(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
Line 550 EDITBUTTON
|
Line 592 EDITBUTTON
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
sub edit_controls { |
|
my $result .= (<<EDITBUTTON); |
|
<form method="post"> |
|
<input type="submit" name="editmode" accesskey="e" value="Edit" /> |
|
</form> |
|
<br /> |
|
EDITBUTTON |
|
return $result; |
|
} |
|
|
sub end_body { |
sub end_body { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = &end_p(); # Close off unclosed <p> |
my $currentstring = &end_p(); # Close off unclosed <p> |
Line 1225 sub start_br {
|
Line 1277 sub start_br {
|
$signal = 1; |
$signal = 1; |
} |
} |
} |
} |
if ($signal eq 1) { |
if ($signal != 1) { |
$currentstring .= ' \vskip 0 mm '; |
|
} else { |
|
$currentstring .= '\strut \\\\ \strut '; |
$currentstring .= '\strut \\\\ \strut '; |
} |
} |
|
|
Line 1458 sub start_hr {
|
Line 1508 sub start_hr {
|
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') { |
|
|
|
# <hr /> can't be inside of <sup><sub> thank you LaTeX. |
|
# |
|
my $restart_sub = 0; |
|
my $restart_sup = 0; |
|
|
|
# Since <sub> and <sup> are simple tags it's ok to turn off/on |
|
# using the start_ stop_ functions.. those tags only care about |
|
# $target. |
|
|
|
if (&is_inside_of($tagstack, "sub")) { |
|
$restart_sub = 1; |
|
$currentstring .= &end_sub($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
if (&is_inside_of($tagstack, "sup")) { |
|
$restart_sup = 1; |
|
$currentstring .= &end_sup($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
|
my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
if (defined $LaTeXwidth) { |
if (defined $LaTeXwidth) { |
if ($LaTeXwidth=~/^%/) { |
if ($LaTeXwidth=~/^%/) { |
Line 1478 sub start_hr {
|
Line 1549 sub start_hr {
|
} |
} |
$currentstring .= ' \vskip 0 mm \noindent\makebox['.$LaTeXwidth.']{'.$pre.'\makebox['. |
$currentstring .= ' \vskip 0 mm \noindent\makebox['.$LaTeXwidth.']{'.$pre.'\makebox['. |
$LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm '; |
$LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm '; |
|
# Turn stuff back on that we can't be inside of. |
|
|
|
if ($restart_sub) { |
|
$currentstring .= &start_sub($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
if ($restart_sup) { |
|
$currentstring .= &start_sup($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1508 sub start_div {
|
Line 1589 sub start_div {
|
} |
} |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
# 4 possible alignments: left, right, center, and -missing-. |
# 4 possible alignments: left, right, center, and -missing-. |
|
# If inside a table row, we must let the table logic |
|
# do the alignment, however. |
|
# |
|
|
my $endstring = ''; |
my $endstring = ''; |
|
|
Line 1518 sub start_div {
|
Line 1602 sub start_div {
|
$endstring = '\end{center}'; |
$endstring = '\end{center}'; |
if (&is_inside_of($tagstack, "table")) { |
if (&is_inside_of($tagstack, "table")) { |
$currentstring = ¢er_correction().$currentstring; |
$currentstring = ¢er_correction().$currentstring; |
|
$endstring .= ¢er_end_correction(); |
} |
} |
} |
} |
elsif ($align eq 'right') { |
elsif ($align eq 'right') { |
Line 1573 sub end_a {
|
Line 1658 sub end_a {
|
&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); |
&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); |
my $name = |
my $name = |
&Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1); |
&Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1); |
if ($href =~ /\S/) { |
my $uriprint = |
|
&Apache::lonxml::get_param('uriprint',$parstack,$safeeval,undef,1); |
|
my $anchorprint = |
|
&Apache::lonxml::get_param('anchorprint',$parstack,$safeeval,undef,1); |
|
if (($href =~ /\S/) && ($uriprint=~/^on|uriprint|yes|1$/i)) { |
$href =~ s/([^\\])%/$1\\\%/g; |
$href =~ s/([^\\])%/$1\\\%/g; |
$currentstring .= ' ({\tt URI:'.&Apache::lonxml::latex_special_symbols($href).'})'; |
# Substitute special symbols... and allow line breaks at each / |
} elsif ($name =~ /\S/) { |
# |
|
$href = &Apache::lonxml::latex_special_symbols($href); |
|
$href =~ s/\//\/\\-/g; # Map / to /\- to allow hyphenation. |
|
$currentstring .= ' ({\tt URI:'.$href.'})'; |
|
} elsif (($name =~ /\S/) && ($anchorprint=~/^on|anchorprint|yes|1$/i)) { |
$currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})'; |
$currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})'; |
} else { |
} else { |
$currentstring.=''; |
$currentstring.=''; |
Line 1925 sub start_table {
|
Line 2018 sub start_table {
|
if ($#Apache::londefdef::table==0) { |
if ($#Apache::londefdef::table==0) { |
$textwidth=&recalc($env{'form.textwidth'}); #result is always in mm |
$textwidth=&recalc($env{'form.textwidth'}); #result is always in mm |
$textwidth=~/(\d+\.?\d*)/; |
$textwidth=~/(\d+\.?\d*)/; |
$textwidth=0.95*$1; #accounts "internal" LaTeX space for table frame |
$textwidth=0.85*$1; #accounts "internal" LaTeX space for table frame |
} else { |
} else { |
if ($Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]=~/\d/) { |
if ($Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]=~/\d/) { |
#the maximum width of nested table is determined by LATeX width of parent cell |
#the maximum width of nested table is determined by LATeX width of parent cell |
Line 1951 sub start_table {
|
Line 2044 sub start_table {
|
} else { |
} else { |
$TeXwidth = $textwidth; |
$TeXwidth = $textwidth; |
} |
} |
} else { |
|
$Apache::londefdef::table[-1]{'forcedtablewidth'} = 1; |
|
} |
} |
|
# if the width is specified as a % it is converted to an absolute width. |
|
# otherwise.. just plugged right in the hash |
|
|
if ($TeXwidth=~/%/) { |
if ($TeXwidth=~/%/) { |
$Apache::londefdef::table[-1]{'percent'}=1; |
|
$TeXwidth=~/(\d+)/; |
$TeXwidth=~/(\d+)/; |
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; |
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; |
} else { |
} else { |
Line 1966 sub start_table {
|
Line 2059 sub start_table {
|
if ($Apache::londefdef::table[-1]{'width'} > $textwidth) { |
if ($Apache::londefdef::table[-1]{'width'} > $textwidth) { |
$Apache::londefdef::table[-1]{'width'} = $textwidth; |
$Apache::londefdef::table[-1]{'width'} = $textwidth; |
} |
} |
|
|
#table's border |
#table's border |
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
Line 2006 sub end_table {
|
Line 2098 sub end_table {
|
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $inmemory = ''; |
my $inmemory = ''; |
my $output = ''; |
my $output = ''; |
my $WARNING=''; |
my $WARNING=''; |
#width of columns from TeXwidth attributes |
#width of columns from TeXwidth attributes |
|
|
|
# Protect against unbalanced </table> tag. |
|
|
|
if (scalar(@Apache::londefdef::table) > 0) { |
|
|
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]<$Apache::londefdef::table[-1]{'TeXlen'}[$in][$jn]) { |
if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]<$Apache::londefdef::table[-1]{'TeXlen'}[$in][$jn]) { |
Line 2028 sub end_table {
|
Line 2125 sub end_table {
|
$available_space=$available_space-$Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]; |
$available_space=$available_space-$Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]; |
} |
} |
} |
} |
|
|
#boundaries for contents columns |
#boundaries for contents columns |
my @min_len=();#columns can not be narrower |
my @min_len=();#columns can not be narrower |
my @max_len=();#maximum length of column |
my @max_len=();#maximum length of column |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
my $avg_max; |
|
my $avg_min; |
|
my $counter_cols = $Apache::londefdef::table[-1]{'counter_columns'}; |
|
for (my $jn=0;$jn<=$counter_cols; $jn++) { |
my ($localmin,$localmax)=(0,0); |
my ($localmin,$localmax)=(0,0); |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
if ($localmin<$Apache::londefdef::table[-1]{'minlen'}[$in][$jn]) { |
if ($localmin<$Apache::londefdef::table[-1]{'minlen'}[$in][$jn]) { |
Line 2043 sub end_table {
|
Line 2144 sub end_table {
|
} |
} |
push @min_len, $localmin; |
push @min_len, $localmin; |
push @max_len, $localmax; |
push @max_len, $localmax; |
|
$avg_max = $localmax + $avg_max; |
|
$avg_min = $localmin + $avg_min; |
} |
} |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
# Does not really matter what the average max/min are if there are no cols. |
|
# and this prevents div 0 in that case. |
|
|
|
if ($counter_cols != 0) { |
|
$avg_max = $avg_max/$counter_cols; |
|
$avg_min = $avg_min/$counter_cols; |
|
} |
|
|
|
|
|
# I don't think the below is needed.. but just in case: |
|
|
|
if ($avg_min > $avg_max) { |
|
my $temp = $avg_min; |
|
$avg_min = $avg_max; |
|
$avg_max = $temp; |
|
} |
|
|
|
|
|
for (my $jn=0;$jn<=$counter_cols;$jn++) { |
my $localmin=0,; |
my $localmin=0,; |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
if ($localmin<$Apache::londefdef::table[-1]{'objectlen'}[$in][$jn]) { |
if ($localmin<$Apache::londefdef::table[-1]{'objectlen'}[$in][$jn]) { |
Line 2063 sub end_table {
|
Line 2184 sub end_table {
|
$min_len[$jn]=0; |
$min_len[$jn]=0; |
$max_len[$jn]=0; |
$max_len[$jn]=0; |
} |
} |
|
# Spans seem to be really bothered by max/min = 0. So if we have one |
|
# make it an average joe max/min. |
|
|
|
if ($max_len[$jn] == 0) { |
|
$max_len[$jn] = $avg_max; |
|
} |
|
if ($min_len[$jn] == 0) { |
|
$min_len[$jn] = $avg_min; |
|
} |
|
|
} |
} |
#final adjustment of column width |
#final adjustment of column width |
my @fwidth=@{$Apache::londefdef::table[-1]{'TeXlen'}[0]};#final width array |
my @fwidth=@{$Apache::londefdef::table[-1]{'TeXlen'}[0]};#final width array |
my @adjust=(); |
my @adjust=(); |
#step 1. adjustment by maximum value |
#step 1. adjustment by maximum value |
my $space_neeeded=0; |
my $space_needed=0; |
for (my $jn=0;$jn<=$#max_len;$jn++) { |
for (my $jn=0;$jn<=$#max_len;$jn++) { |
$space_neeeded=$space_neeeded+$max_len[$jn]; |
$space_needed=$space_needed+$max_len[$jn]; |
} |
} |
if ($space_neeeded<=$available_space) { |
if ($space_needed<=$available_space) { |
|
|
for (my $jn=0;$jn<=$#max_len;$jn++) { |
for (my $jn=0;$jn<=$#max_len;$jn++) { |
if ($fwidth[$jn]==0) { |
if ($fwidth[$jn]==0) { |
$fwidth[$jn]=$max_len[$jn]; |
$fwidth[$jn]=$max_len[$jn]; |
Line 2080 sub end_table {
|
Line 2212 sub end_table {
|
} |
} |
} else { |
} else { |
#step 2. adjustment by minimum value (estimation) |
#step 2. adjustment by minimum value (estimation) |
$space_neeeded=0; |
$space_needed=0; |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
$space_neeeded+=$min_len[$jn]; |
$space_needed+=$min_len[$jn]; |
} |
} |
if ($space_neeeded>$available_space) { |
if ($space_needed>$available_space) { |
$WARNING=' \textbf{NOT ENOUGH SPACE FOR TABLE} '; |
$WARNING=' \textbf{NOT ENOUGH SPACE FOR TABLE} '; |
for (my $jn=0;$jn<=$#max_len;$jn++) { |
for (my $jn=0;$jn<=$#max_len;$jn++) { |
if ($fwidth[$jn]==0) { |
if ($fwidth[$jn]==0) { |
Line 2101 sub end_table {
|
Line 2233 sub end_table {
|
} |
} |
} |
} |
if ($how_many_to_scale>0) { |
if ($how_many_to_scale>0) { |
my $space_to_adjust=($space_neeeded-$available_space)/$how_many_to_scale; |
my $space_to_adjust=($space_needed-$available_space)/$how_many_to_scale; |
foreach my $jn (@to_scale) { |
foreach my $jn (@to_scale) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
$Apache::londefdef::table[-1]{'content'}[$in][$jn]=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/; |
$Apache::londefdef::table[-1]{'content'}[$in][$jn]=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/; |
Line 2123 sub end_table {
|
Line 2255 sub end_table {
|
} |
} |
} else { |
} else { |
#step 3. adjustment over minimal + corrections |
#step 3. adjustment over minimal + corrections |
my $enlarge_coef=$available_space/$space_neeeded; |
my $enlarge_coef=$available_space/$space_needed; |
my $acsessive=0; |
my $acsessive=0; |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
$adjust[$jn]=$min_len[$jn]*$enlarge_coef; |
$adjust[$jn]=$min_len[$jn]*$enlarge_coef; |
Line 2131 sub end_table {
|
Line 2263 sub end_table {
|
$fwidth[$jn]=$max_len[$jn]; |
$fwidth[$jn]=$max_len[$jn]; |
$acsessive=$acsessive+$adjust[$jn]-$max_len[$jn]; |
$acsessive=$acsessive+$adjust[$jn]-$max_len[$jn]; |
$adjust[$jn]=0; |
$adjust[$jn]=0; |
|
|
} |
} |
} |
} |
if ($acsessive>0) { |
if ($acsessive>0) { |
Line 2155 sub end_table {
|
Line 2288 sub end_table {
|
} |
} |
} |
} |
} |
} |
#use all available width if it is defined in % or as TeXwidth |
# use all available width or specified width as if not specified, |
if (($Apache::londefdef::table[-1]{'percent'}==1) || ($Apache::londefdef::table[-1]{'forcetablewidth'}==1)) { |
# the specified width gets defaulted to the available width. |
my $current=0; |
|
for (my $i=0;$i<=$#fwidth;$i++) { |
my $current=0; |
$current+=$fwidth[$i]; |
for (my $i=0;$i<=$#fwidth;$i++) { |
} |
$current+=$fwidth[$i]; |
my $coef=$Apache::londefdef::table[-1]{'width'}/$current; |
} |
for (my $i=0;$i<=$#fwidth;$i++) { |
if ($current == 0) { |
$fwidth[$i]*=$coef; |
$current = $Apache::londefdef::table[-1]{'width'}; |
} |
} |
|
my $coef=$Apache::londefdef::table[-1]{'width'}/$current; |
|
for (my $i=0;$i<=$#fwidth;$i++) { |
|
$fwidth[$i]*=$coef; |
} |
} |
#removing of empty columns if allowed |
#removing of empty columns if allowed |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
Line 2185 sub end_table {
|
Line 2321 sub end_table {
|
$Apache::londefdef::table[-1]{'content'}=\@cleaned_table; |
$Apache::londefdef::table[-1]{'content'}=\@cleaned_table; |
@fwidth=@cleaned_header; |
@fwidth=@cleaned_header; |
} |
} |
|
|
|
|
#construct header of the table |
#construct header of the table |
my $header_of_table = '{'.$Apache::londefdef::table[-1]{'vvinc'}; |
my $header_of_table = '{'.$Apache::londefdef::table[-1]{'vvinc'}; |
for (my $in=0;$in<=$#fwidth;$in++) { |
for (my $in=0;$in<=$#fwidth;$in++) { |
$header_of_table.='p{'.$fwidth[$in].' mm}'.$Apache::londefdef::table[-1]{'vvinc'}; |
$header_of_table.='p{'.$fwidth[$in].' mm}'.$Apache::londefdef::table[-1]{'vvinc'}; |
} |
} |
$header_of_table .= '}'; |
$header_of_table .= '}'; |
|
|
#fill the table |
#fill the table |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
my $have_rowspan = 0; |
my $have_rowspan = 0; |
Line 2201 sub end_table {
|
Line 2340 sub end_table {
|
# single rowspan, columspan and combined row/colspans will |
# single rowspan, columspan and combined row/colspans will |
# work correctly. LaTeX is delicate here. |
# work correctly. LaTeX is delicate here. |
# RF. |
# RF. |
|
|
# Start a rowspan if necessary: |
# Start a rowspan if necessary: |
|
|
|
my $primary_col_width = $fwidth[$jn]; # Width of primary column. |
my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; |
my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; |
my $colspan = $Apache::londefdef::table[-1]{'colspan'}[$in][$jn]; |
my $colspan = $Apache::londefdef::table[-1]{'colspan'}[$in][$jn]; |
# |
# |
# Do the appropriate magic if this has a colspan |
# Do the appropriate magic if this has a colspan |
# |
# |
|
|
|
my $border_char = ""; |
|
if ($border) { |
|
$border_char = "|"; |
|
} |
|
my $spanwidth = 0; |
if ($colspan > 1) { |
if ($colspan > 1) { |
my $spanwidth = 0; |
|
for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) { |
for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) { |
$spanwidth += $fwidth[$spancol]; |
$spanwidth += $fwidth[$spancol]; |
} |
} |
Line 2219 sub end_table {
|
Line 2363 sub end_table {
|
$colspan |
$colspan |
."}"; |
."}"; |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output .= '{|c|}{'; |
$output .= '{'.$border_char.'c'.$border_char.'}{'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output .= '{|r|}{'; |
$output .= '{'.$border_char.'r'.$border_char.'}{'; |
} |
} |
else { |
else { |
$output .= "{|p{$spanwidth mm}|}{"; |
$output .= '{'.$border_char."p{$spanwidth mm}".$border_char.'}{'; |
} |
} |
|
|
|
} else { |
|
$spanwidth = $primary_col_width; # If no span width will be just colwidth |
} |
} |
|
|
# Rowspan... if colspan is 1, and there's an alignment we'll need |
# Rowspan... if colspan is 1, and there's an alignment we'll need |
Line 2238 sub end_table {
|
Line 2384 sub end_table {
|
if ($rowspan > 1) { |
if ($rowspan > 1) { |
if ($colspan == 1) { |
if ($colspan == 1) { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output .= '\multicolumn{1}{|c|}{'; |
$output .= '\multicolumn{1}{'.$border_char.'c'.$border_char.'}{'; |
$multirow_aligned = 1; |
$multirow_aligned = 1; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output .= '\multicolumn{1}{|r|}{'; |
$output .= '\multicolumn{1}{'.$border_char.'r'.$border_char.'}{'; |
$multirow_aligned = 1; |
$multirow_aligned = 1; |
} |
} |
} |
} |
$have_rowspan++; |
$have_rowspan++; |
$output .= '\multirow{'.$rowspan.'}[0]{*}{'; |
if ($multirow_aligned) { |
|
$output .= '\multirow{'.$rowspan.'}[0]{*}{'; |
|
} else { |
|
$output .= '\multirow{'.$rowspan."}[0]{$spanwidth mm}{"; |
|
} |
|
|
$Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ |
$Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ |
s{^\s*\\par\s*}{}; |
s{^\s*\\par\s*}{}; |
$Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ |
$Apache::londefdef::table[-1]{'content'}[$in][$jn] =~ |
s{\s*\\vskip\s*0pt\s*$}{}; |
s{\s*\\vskip\s*0pt\s*$}{}; |
|
|
# |
# |
# If we did not throw in a multicolumn to align, then add |
# If we did not throw in a multicolumn to align, then add |
# an extra { |
# an extra { |
Line 2266 sub end_table {
|
Line 2416 sub end_table {
|
if (($rowspan eq '^') || ($rowspan eq '_')) { |
if (($rowspan eq '^') || ($rowspan eq '_')) { |
$have_rowspan++; |
$have_rowspan++; |
} |
} |
#-------------------------------------------------------------- |
#-------------------------------------------------------------- |
|
|
|
|
# For right and center alignment of single cells. |
# For right and center alignment of single cells. |
Line 2274 sub end_table {
|
Line 2424 sub end_table {
|
# |
# |
if ($colspan == 1 && $rowspan == 1) { |
if ($colspan == 1 && $rowspan == 1) { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output .= '\multicolumn{1}{|c|}{'; |
$output .= '\multicolumn{1}{'.$border_char.'c'.$border_char.'}{'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output .= '\multicolumn{1}{|r|}{'; |
$output .= '\multicolumn{1}{'.$border_char.'r'.$border_char.'}{'; |
} |
} |
} |
} |
|
|
Line 2361 sub end_table {
|
Line 2511 sub end_table {
|
undef @Apache::londefdef::table; |
undef @Apache::londefdef::table; |
} |
} |
} |
} |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 2511 sub end_td_tex {
|
Line 2662 sub end_td_tex {
|
|
|
my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
if (defined $TeXwidth) { |
if (defined $TeXwidth) { |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
for (my $c = 0; $c < $colspan; $c++) { |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
} |
} else { |
} else { |
if (($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) or ($data=~m/\[(\d+\.?\d*)\s*mm\]/)) { |
if (($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) or ($data=~m/\[(\d+\.?\d*)\s*mm\]/)) { |
my $garbage_data=$data; |
my $garbage_data=$data; |
Line 2529 sub end_td_tex {
|
Line 2682 sub end_td_tex {
|
if ($fwidth<$current_length) {$fwidth=$current_length;} |
if ($fwidth<$current_length) {$fwidth=$current_length;} |
$garbage_data=~s/\[(\d+\.?\d*)\s*mm\]//; |
$garbage_data=~s/\[(\d+\.?\d*)\s*mm\]//; |
} |
} |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
for (my $c = 0; $c < $colspan; $c++) { |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$fwidth; |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$fwidth; |
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
} |
} elsif ($data=~/\\parbox\{\s*\d+\.?\d*\s*(mm|cm|in|pc|pt)*\s*\}/ or $data=~/\\epsfxsize\s*=\s*\d+\.?\d*\s*(mm|cm|in|pc|pt)*/) { |
} elsif ($data=~/\\parbox\{\s*\d+\.?\d*\s*(mm|cm|in|pc|pt)*\s*\}/ or $data=~/\\epsfxsize\s*=\s*\d+\.?\d*\s*(mm|cm|in|pc|pt)*/) { |
my $garbage_data=$data; |
my $garbage_data=$data; |
my $fwidth=0; |
my $fwidth=0; |
Line 2548 sub end_td_tex {
|
Line 2703 sub end_td_tex {
|
if ($fwidth<$1) {$fwidth=$1;} |
if ($fwidth<$1) {$fwidth=$1;} |
$garbage_data=~s/\\epsfxsize\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)//; |
$garbage_data=~s/\\epsfxsize\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)//; |
} |
} |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
for (my $c = 0; $c < $colspan; $c++) { |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$fwidth; |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$fwidth; |
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
|
} |
$data=~s/\\\\\s*$//; |
$data=~s/\\\\\s*$//; |
} else { |
} else { |
$data=~s/^\s+(\S.*)/$1/; |
$data=~s/^\s+(\S.*)/$1/; |
Line 2579 sub end_td_tex {
|
Line 2736 sub end_td_tex {
|
if ($min_length<$lengthword) {$min_length=$lengthword;} |
if ($min_length<$lengthword) {$min_length=$lengthword;} |
} |
} |
} |
} |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
for (my $c = 0; $c < $colspan; $c++) { |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$current_length; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$min_length; |
push @ {$Apache::londefdef::table[-1]{'maxlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$current_length; |
|
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$min_length; |
|
} |
} |
} |
} |
} |
# Substitute all of the tables nested in this cell in their appropriate places. |
# Substitute all of the tables nested in this cell in their appropriate places. |
Line 2895 sub start_img {
|
Line 3054 sub start_img {
|
# And here's where the semi-quote breaks down: allow the user |
# And here's where the semi-quote breaks down: allow the user |
# to edit the beast as well by rendering the problem for edit: |
# to edit the beast as well by rendering the problem for edit: |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
|
my $only = join(',',&Apache::loncommon::filecategorytypes('Pictures')); |
$currentstring .=&Apache::edit::tag_start($target,$token); |
$currentstring .=&Apache::edit::tag_start($target,$token); |
$currentstring .=&Apache::edit::text_arg('Image Url:','src',$token,70). |
$currentstring .=&Apache::edit::text_arg('Image Url:','src',$token,70). |
&Apache::edit::browse('src',undef,'alt').' '. |
&Apache::edit::browse('src',undef,'alt',$only).' '. |
&Apache::edit::search('src',undef,'alt').'<br />'; |
&Apache::edit::search('src',undef,'alt').'<br />'; |
$currentstring .=&Apache::edit::text_arg('Description:','alt',$token,70).'<br />'; |
$currentstring .=&Apache::edit::text_arg('Description:','alt',$token,70).'<br />'; |
$currentstring .=&Apache::edit::text_arg('width (pixel):','width',$token,5); |
$currentstring .=&Apache::edit::text_arg('width (pixel):','width',$token,5); |
Line 2916 sub start_img {
|
Line 3076 sub start_img {
|
my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval); |
my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval); |
my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval); |
my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval); |
|
|
|
if ($token->[2]{'src'}=~/\$/) { |
$currentstring .= '<img src="'.$src.'" alt="'.$alt.'" '; |
$currentstring.='Variable image source'; |
if ($width) { $currentstring.=' width="'.$width.'" '; } |
} else { |
if ($height) { $currentstring.=' height="'.$height.'" '; } |
$currentstring .= '<img src="'.$src.'" alt="'.$alt.'" '; |
$currentstring .= ' />'; |
if ($width) { $currentstring.=' width="'.$width.'" '; } |
|
if ($height) { $currentstring.=' height="'.$height.'" '; } |
|
$currentstring .= ' />'; |
|
} |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my ($osrc,$owidth,$oheight)= |
my ($osrc,$owidth,$oheight)= |
($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'}); |
($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'}); |
Line 3003 sub start_applet {
|
Line 3166 sub start_applet {
|
$currentstring='[APPLET: '.$alttag.']'; |
$currentstring='[APPLET: '.$alttag.']'; |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
# Turn off some stuff we can't be inside thank you LaTeX |
|
|
|
|
|
my $restart_sub = 0; |
|
my $restart_sup = 0; |
|
|
|
# Since <sub> and <sup> are simple tags it's ok to turn off/on |
|
# using the start_ stop_ functions.. those tags only care about |
|
# $target. |
|
|
|
if (&is_inside_of($tagstack, "sub")) { |
|
$restart_sub = 1; |
|
$currentstring .= &end_sub($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
if (&is_inside_of($tagstack, "sup")) { |
|
$restart_sup = 1; |
|
$currentstring .= &end_sup($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
|
|
# Now process the applet; just replace it with its alt attribute. |
|
|
my $alttag= &Apache::lonxml::get_param('alt',$parstack, |
my $alttag= &Apache::lonxml::get_param('alt',$parstack, |
$safeeval,undef,1); |
$safeeval,undef,1); |
unless ($alttag) { |
unless ($alttag) { |
Line 3013 sub start_applet {
|
Line 3199 sub start_applet {
|
} |
} |
$currentstring.='\begin{center} \fbox{Java Applet: '.$alttag. |
$currentstring.='\begin{center} \fbox{Java Applet: '.$alttag. |
'.}\end{center}'; |
'.}\end{center}'; |
|
|
|
# Turn stuff back on that we can't be inside of. |
|
|
|
if ($restart_sub) { |
|
$currentstring .= &start_sub($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
|
if ($restart_sup) { |
|
$currentstring .= &start_sup($target, $token, $tagstack, |
|
$parstack, $parser, $safeeval); |
|
} |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 4366 sub align_latex_image {
|
Line 4563 sub align_latex_image {
|
my ($align, $latex_rendering, $image, $width, $height) = @_; |
my ($align, $latex_rendering, $image, $width, $height) = @_; |
my $currentstring; # The 1/2 wrapped image. |
my $currentstring; # The 1/2 wrapped image. |
my $closure; # The closure of the wrappage. |
my $closure; # The closure of the wrappage. |
|
|
|
# if it's none just return it back |
|
if ($latex_rendering eq 'none') { |
|
return ($image,''); |
|
} |
|
|
# 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, |