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

version 1.329, 2006/05/17 22:08:08 version 1.337, 2006/09/19 10:57:11
Line 183  sub start_html { Line 183  sub start_html {
     if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) {      if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) {
  # start_body() takes care of emitting the <html>    # start_body() takes care of emitting the <html> 
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\documentclass[letterpaper,twoside]{article}';   $currentstring .= 
       '\documentclass[letterpaper,twoside]{article}\raggedbottom';
  if (($env{'form.latex_type'}=~'batchmode') ||   if (($env{'form.latex_type'}=~'batchmode') ||
             (!$env{'request.role.adv'})) {$currentstring .='\batchmode';}               (!$env{'request.role.adv'})) {$currentstring .='\batchmode';} 
  $currentstring .= '\newcommand{\keephidden}[1]{}'.   $currentstring .= '\newcommand{\keephidden}[1]{}'.
Line 533  sub start_body { Line 534  sub start_body {
     'force_register' => 1});      'force_register' => 1});
   
  if ($env{'request.state'} ne 'published') {   if ($env{'request.state'} ne 'published') {
       $currentstring.=&Apache::lonmenu::constspaceform();
     $currentstring.=(<<EDITBUTTON);      $currentstring.=(<<EDITBUTTON);
 <form method="post">  <form method="post">
 <input type="submit" name="editmode" accesskey="e" value="Edit" />  <input type="submit" name="editmode" accesskey="e" value="Edit" />
Line 559  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 583  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 1152  sub start_p { Line 1161  sub start_p {
  $currentstring .= &end_p(); # close off prior para if in progress.   $currentstring .= &end_p(); # close off prior para if in progress.
  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 .='\begin{center}\par';      $currentstring .='\begin{center}\par ';
     $closing_string = '\end{center}';      $closing_string = '\end{center}';
     if (&is_inside_of($tagstack, "table")) {      if (&is_inside_of($tagstack, "table")) {
  $currentstring = &center_correction().$currentstring;   $currentstring = &center_correction().$currentstring;
Line 1208  sub start_br { Line 1217  sub start_br {
  #   #
  for (my $i=$#tempo;$i>=0;$i--) {   for (my $i=$#tempo;$i>=0;$i--) {
     if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') ||      if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') ||
                 ($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul') ||                  ($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul'))  {
                 ($tempo[$i] eq 'td') || ($tempo[$i] eq 'th'))  {  
  $signal=1;   $signal=1;
  last;      }
       if (($tempo[$i] eq 'td') || ($tempo[$i] eq 'th')) {
    $signal = 1;
     }      }
  }   }
  if ($signal) {   if ($signal eq 1) {
     $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 2197  sub end_table { Line 2207  sub end_table {
  #    # 
   
  if ($colspan > 1) {   if ($colspan > 1) {
       my $spanwidth = 0;
       for (my $spancol = $jn; $spancol < $jn + $colspan; $spancol++) {
    $spanwidth += $fwidth[$spancol];
       }
     $output .= '\multicolumn{'.      $output .= '\multicolumn{'.
  $colspan   $colspan
  .'}{|l|}{';   ."}";
       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...
  #   #
Line 2865  sub start_img { Line 2921  sub start_img {
    ['','bottom','middle','top','left','right'],$token,5);     ['','bottom','middle','top','left','right'],$token,5);
  $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',   $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',
    ['', 'parbox', 'parpic'], $token, 2);     ['', 'parbox', 'parpic'], $token, 2);
  $currentstring .=&Apache::edit::select_arg('Encyrpt URL:','encrypturl',   $currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl',
    ['no','yes'], $token, 2);     ['no','yes'], $token, 2);
  $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();   $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
  my $src=    &Apache::lonxml::get_param('src',$parstack,$safeeval);   my $src=    &Apache::lonxml::get_param('src',$parstack,$safeeval);

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


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