version 1.223, 2004/07/12 15:46:52
|
version 1.228, 2004/07/14 13:49:09
|
Line 1133 sub end_p {
|
Line 1133 sub end_p {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring .= $token->[2]; |
$currentstring .= $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
if ($$tagstack[-1] eq 'p') { |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
if ($align eq 'center') { |
if ($align eq 'center') { |
$currentstring .= '\end{center}'; |
$currentstring .= '\end{center}'; |
} elsif ($align eq 'right') { |
} elsif ($align eq 'right') { |
$currentstring .= '}}'; |
$currentstring .= '}}'; |
} elsif ($align eq 'left') { |
} elsif ($align eq 'left') { |
$currentstring .= '}\hfill}'; |
$currentstring .= '}\hfill}'; |
|
} |
|
} |
} |
} |
} |
return $currentstring; |
return $currentstring; |
Line 1154 sub start_br {
|
Line 1152 sub start_br {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring .= $token->[4]; |
$currentstring .= $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
if (($$tagstack[-2] eq 'b') || ($$tagstack[-2] eq 'strong') || |
my @tempo=@$tagstack; |
($$tagstack[-2] eq 'ol') || ($$tagstack[-2] eq 'ul')) { |
my $sygnal=0; |
|
for (my $i=$#tempo;$i>=0;$i--) { |
|
if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') || |
|
($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul')) { |
|
$sygnal=1; |
|
last; |
|
} |
|
} |
|
if ($sygnal) { |
$currentstring .= ' \vskip 0 mm '; |
$currentstring .= ' \vskip 0 mm '; |
} elsif ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { |
} elsif ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { |
$currentstring .= '\strut \\\\ \strut '; |
$currentstring .= '\strut \\\\ \strut '; |
Line 1797 sub start_table {
|
Line 1803 sub start_table {
|
$textwidth=$Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]; |
$textwidth=$Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]; |
} else { |
} else { |
#try to use all space not used before (minus 5% for LaTeX table internal) - rather silly |
#try to use all space not used before (minus 5% for LaTeX table internal) - rather silly |
my $textwidth=$Apache::londefdef::table[-2]{'width'}; |
$textwidth=$Apache::londefdef::table[-2]{'width'}; |
for (my $i=0;$i<$Apache::londefdef::table[-2]{'counter_columns'};$i++) { |
for (my $i=0;$i<$Apache::londefdef::table[-2]{'counter_columns'};$i++) { |
$textwidth=$textwidth-$Apache::londefdef::table[-2]{'TeXlen'}[0][$i]; |
$textwidth=$textwidth-$Apache::londefdef::table[-2]{'TeXlen'}[0][$i]; |
} |
} |
Line 1868 sub end_table {
|
Line 1874 sub end_table {
|
} |
} |
#free space and number of empty columns |
#free space and number of empty columns |
my ($available_space,$empty_columns)=($Apache::londefdef::table[-1]{'width'},0); |
my ($available_space,$empty_columns)=($Apache::londefdef::table[-1]{'width'},0); |
## &Apache::lonnet::logthis("Available space $Apache::londefdef::table[-1]{'width'}"); |
if ($#Apache::londefdef::table ne 0) {$available_space=0.9*$available_space;} |
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]==0) { |
if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]==0) { |
$empty_columns++; |
$empty_columns++; |
Line 1891 sub end_table {
|
Line 1897 sub end_table {
|
} |
} |
push @min_len, $localmin; |
push @min_len, $localmin; |
push @max_len, $localmax; |
push @max_len, $localmax; |
&Apache::lonnet::logthis("TABLEOUTPUT1: $localmin><$localmax<<<"); |
|
} |
} |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
my $localmin=0,; |
my $localmin=0,; |
Line 1906 sub end_table {
|
Line 1911 sub end_table {
|
$min_len[$jn]=0; |
$min_len[$jn]=0; |
$max_len[$jn]=0; |
$max_len[$jn]=0; |
} |
} |
&Apache::lonnet::logthis("TABLEOUTPUT2: $min_len[$jn]><$max_len[$jn]<<<"); |
|
} |
} |
#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 |
Line 1921 sub end_table {
|
Line 1925 sub end_table {
|
if ($fwidth[$jn]==0) { |
if ($fwidth[$jn]==0) { |
$fwidth[$jn]=$max_len[$jn]; |
$fwidth[$jn]=$max_len[$jn]; |
} |
} |
&Apache::lonnet::logthis("TABLEOUTPUT3: $fwidth[$jn]<<<"); |
|
} |
} |
} else { |
} else { |
#step 2. adjustment by minimum value (estimation) |
#step 2. adjustment by minimum value (estimation) |
Line 1935 sub end_table {
|
Line 1938 sub end_table {
|
if ($fwidth[$jn]==0) { |
if ($fwidth[$jn]==0) { |
$fwidth[$jn]=$min_len[$jn]; |
$fwidth[$jn]=$min_len[$jn]; |
} |
} |
&Apache::lonnet::logthis("TABLEOUTPUT4: $fwidth[$jn]<<<"); |
|
} |
} |
} else { |
} else { |
#step 3. adjustment over minimal + corrections |
#step 3. adjustment over minimal + corrections |
Line 1948 sub end_table {
|
Line 1950 sub end_table {
|
$acsessive=$acsessive+$adjust[$jn]-$max_len[$jn]; |
$acsessive=$acsessive+$adjust[$jn]-$max_len[$jn]; |
$adjust[$jn]=0; |
$adjust[$jn]=0; |
} |
} |
&Apache::lonnet::logthis("TABLEOUTPUT10: $adjust[$jn]<<<"); |
|
&Apache::lonnet::logthis("TABLEOUTPUT10a: $acsessive<<<"); |
|
} |
} |
if ($acsessive>0) { |
if ($acsessive>0) { |
#we have an excess of space and can redistribute it |
#we have an excess of space and can redistribute it |
Line 1965 sub end_table {
|
Line 1965 sub end_table {
|
$adjust[$jn]+=$per_column; |
$adjust[$jn]+=$per_column; |
$fwidth[$jn]=$adjust[$jn]; |
$fwidth[$jn]=$adjust[$jn]; |
} |
} |
&Apache::lonnet::logthis("TABLEOUTPUT5: $fwidth[$jn]<<<"); |
|
} |
} |
} else { |
} else { |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
for (my $jn=0;$jn<=$#min_len;$jn++) { |
Line 2014 sub end_table {
|
Line 2013 sub end_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++) { |
for (my $jn=0;$jn<=$#fwidth;$jn++) { |
for (my $jn=0;$jn<=$#fwidth;$jn++) { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output.='\begin{center}'; |
$output.='\vspace*{-6 mm}\begin{center}'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output.=' \hfill \llap{' |
$output.=' \hfill \llap{' |
} |
} |
$output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn]; |
$output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn]; |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output.='\end{center}'; |
$output.='\end{center}\vspace*{-6 mm}'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output.='} '; |
$output.='} '; |
} |
} |
Line 2178 sub end_td_tex {
|
Line 2177 sub end_td_tex {
|
$current_length=2.5*&LATEX_length($data); |
$current_length=2.5*&LATEX_length($data); |
my @words=split(/ /,$data); |
my @words=split(/ /,$data); |
foreach my $word (@words) { |
foreach my $word (@words) { |
my $lengthword=2.5*&LATEX_length($word); |
my $lengthword=2*&LATEX_length($word); |
if ($min_length<$lengthword) {$min_length=$lengthword;} |
if ($min_length<$lengthword) {$min_length=$lengthword;} |
} |
} |
} |
} |
Line 2270 sub start_img {
|
Line 2269 sub start_img {
|
undef,1); |
undef,1); |
if (not $src and ($target eq 'web' or $target eq 'tex')) { |
if (not $src and ($target eq 'web' or $target eq 'tex')) { |
my $inside = &Apache::lonxml::get_all_text("/img",$parser); |
my $inside = &Apache::lonxml::get_all_text("/img",$parser); |
&Apache::lonnet::logthis("inside was $inside"); |
|
return ''; |
return ''; |
} |
} |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
Line 3621 sub LATEX_length {
|
Line 3619 sub LATEX_length {
|
$garbage=~s|\\(\w+)\\|\\|g; |
$garbage=~s|\\(\w+)\\|\\|g; |
$garbage=~s|\\(\w+)(\s*)|$2|g; |
$garbage=~s|\\(\w+)(\s*)|$2|g; |
$garbage=~s|\+|11|g; |
$garbage=~s|\+|11|g; |
|
|
&Apache::lonnet::logthis("garbage was just $garbage"); |
|
my $value=length($garbage); |
my $value=length($garbage); |
return $value; |
return $value; |
} |
} |