Diff for /loncom/xml/londefdef.pm between versions 1.336 and 1.337

version 1.336, 2006/09/05 21:57:57 version 1.337, 2006/09/19 10:57:11
Line 561  sub end_body { Line 561  sub end_body {
 }  }
   
 # \begin{center} causes a new paragprah spacing that looks odd inside   # \begin{center} causes a new paragprah spacing that looks odd inside 
 # of a table cell  # of a table cell.  Same at the end of a \center but with a slightly
 sub center_correction { return '\vspace*{-6 mm}'; }  # larger space .. hence center_correction and center_end_correction.
   #
   sub center_correction { return '\vspace*{-6 mm}'; } 
   sub center_end_correction { return '\vspace*{-7 mm}'; }
   
 #-- <center> tag (end tag required)  #-- <center> tag (end tag required)
 sub start_center {  sub start_center {
     my ($target,$token,$tagstack) = @_;      my ($target,$token,$tagstack) = @_;
Line 585  sub end_center { Line 589  sub end_center {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{center}';     $currentstring = '\end{center}';  
    if (&is_inside_of($tagstack, "table")) {
       $currentstring .= &center_end_correction();
    }
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 2206  sub end_table { Line 2213  sub end_table {
     }      }
     $output .= '\multicolumn{'.      $output .= '\multicolumn{'.
  $colspan   $colspan
  ."}{|p{$spanwidth mm}|}{";   ."}";
       if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {
    $output .= '{|c|}{';
       } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {
    $output .= '{|r|}{';
       }
       else {
    $output .= "{|p{$spanwidth mm}|}{";
       }
   
  }   }
   
    # Rowspan... if colspan is 1, and there's an alignment we'll need
    # to kick in a multicolumn in order to get the alignment spec.
    # this must precede the multirow or LaTex gets quite upset.
    # Naturally if colspan > 1 we've already done that above ^
    #
    my $multirow_aligned = 0;
  if ($rowspan > 1) {   if ($rowspan > 1) {
       if ($colspan == 1) {
    if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {
       $output .= '\multicolumn{1}{|c|}{';
       $multirow_aligned = 1;
    } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {
       $output .= '\multicolumn{1}{|r|}{';
       $multirow_aligned = 1;
    }
       }
     $have_rowspan++;      $have_rowspan++;
     $output .= '\multirow{'.$rowspan.'}[0]{'.$fwidth[$jn].'mm}{';      $output .= '\multirow{'.$rowspan.'}[0]{*}{';
       #
       # If we did not throw in a multicolumn to align, then add 
       # an extra {
       # so we close correctly without having to keep additional state
       # around
       #
       if (!$multirow_aligned) {
    $output .= '{';
       }
  }   }
  if (($rowspan eq '^') || ($rowspan eq '_')) {   if (($rowspan eq '^') || ($rowspan eq '_')) {
     $have_rowspan++;      $have_rowspan++;
  }   }
  #--------------------------------------------------------------   #--------------------------------------------------------------
   
  if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {  
     $output.=&center_correction().'\begin{center}';   # For right and center alignment of single cells.
  } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {   # we are going to use a multicolumn with a span of 1 to specify alignment.
     $output.=' \hfill \llap{'   #
    if ($colspan == 1  && $rowspan == 1) {
       if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {
    $output .= '\multicolumn{1}{|c|}{';
       } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {
    $output .= '\multicolumn{1}{|r|}{';
       }
  }   }
   
  $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') {  
     $output.='\end{center}';   if (($colspan == 1 && $rowspan == 1)   &&
  } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {      (($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') ||
     $output.='} ';       ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r'))) {
       $output .= '}';
  }   }
   
  # Close off any open multirow:   # Close off any open multirow:
   
  if ($rowspan > 1) {   if ($rowspan > 1) {
     $output .= '}';      $output .= '}}';
  }   }
  #  Close off the colspan...   #  Close off the colspan...
  #   #

Removed from v.1.336  
changed lines
  Added in v.1.337


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