Diff for /loncom/xml/londefdef.pm between versions 1.355 and 1.366

version 1.355, 2007/02/27 23:44:53 version 1.366, 2007/06/05 22:37:58
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 513  sub end_accessrule { Line 516  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 541  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});
Line 1458  sub start_hr { Line 1476  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 1517  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 1575  sub end_a { Line 1624  sub end_a {
     &Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1);      &Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1);
  if ($href =~ /\S/) {   if ($href =~ /\S/) {
     $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 /
       #
       $href = &Apache::lonxml::latex_special_symbols($href);
       $href =~ s/\//\/\\-/g;              # Map / to /\- to allow hyphenation.
       $currentstring .= ' ({\tt URI:'.$href.'})';
  } elsif ($name =~ /\S/) {   } elsif ($name =~ /\S/) {
     $currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})';      $currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})';
  } else {   } else {
Line 1925  sub start_table { Line 1978  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 2004  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 2019  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 2028  sub end_table { Line 2080  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 2099  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 2139  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
Line 2073  sub end_table { Line 2159  sub end_table {
     $space_neeeded=$space_neeeded+$max_len[$jn];      $space_neeeded=$space_neeeded+$max_len[$jn];
  }   }
  if ($space_neeeded<=$available_space) {   if ($space_neeeded<=$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 2131  sub end_table { Line 2218  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 2243  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++) {     my $coef=$Apache::londefdef::table[-1]{'width'}/$current;
  $fwidth[$i]*=$coef;   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 2273  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 2292  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 $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 2226  sub end_table { Line 2318  sub end_table {
     else {      else {
  $output .= "{|p{$spanwidth mm}|}{";   $output .= "{|p{$spanwidth mm}|}{";
     }      }
       
    } 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 2246  sub end_table { Line 2340  sub end_table {
  }   }
     }      }
     $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 2364  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 2511  sub end_td_tex { Line 2609  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 2629  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 2650  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 2683  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 3003  sub start_applet { Line 3109  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 3142  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;
 }  }

Removed from v.1.355  
changed lines
  Added in v.1.366


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>