Diff for /loncom/xml/londefdef.pm between versions 1.181 and 1.185

version 1.181, 2003/10/14 14:40:33 version 1.185, 2003/10/21 19:40:32
Line 344  sub start_title { Line 344  sub start_title {
     }      }
     if ($target eq 'meta') {      if ($target eq 'meta') {
  $currentstring='<title>';   $currentstring='<title>';
  &start_output();   &start_output($target);
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 358  sub end_title { Line 358  sub end_title {
  $currentstring .= '}';   $currentstring .= '}';
     }        }  
     if ($target eq 'meta') {      if ($target eq 'meta') {
  &end_output();   &end_output($target);
  $currentstring='</title>';   $currentstring='</title>';
     }       } 
     return $currentstring;      return $currentstring;
Line 625  sub start_strong { Line 625  sub start_strong {
 sub end_strong {  sub end_strong {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
   
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '}';     $currentstring = '}';  
Line 655  sub start_h1 { Line 654  sub start_h1 {
  $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';    $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{'; 
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  $currentstring='<subject>';   $currentstring='<subject>';
  &start_output();   &start_output($target);
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 677  sub end_h1 { Line 676  sub end_h1 {
  }   }
  $currentstring .= '}}'.$post;   $currentstring .= '}}'.$post;
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  &end_output();   &end_output($target);
  $currentstring='</subject>';   $currentstring='</subject>';
     }       } 
     return $currentstring;      return $currentstring;
Line 1323  sub start_sub { Line 1322  sub start_sub {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\$_{ ";   $currentstring .= "\$_{";
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 1334  sub end_sub { Line 1333  sub end_sub {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= " }\$";   $currentstring .= "}\$";
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1346  sub start_sup { Line 1345  sub start_sup {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\$^{ ";   $currentstring .= "\$^{";
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 1357  sub end_sup { Line 1356  sub end_sup {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= " }\$";   $currentstring .= "}\$";
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1995  sub end_td_tex { Line 1994  sub end_td_tex {
  $newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g;   $newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g;
  my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata);   my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata);
  foreach my $elementdata (@newdata) {   foreach my $elementdata (@newdata) {
     $elementdata=~s/^\s+(\S.*)/$1/;       my $lengthnewdata=1.8*LATEX_length($elementdata);
     $elementdata=~s/(.*\S)\s+$/$1/;  
     $elementdata=~s/(\s)+/$1/;  
     my $lengthnewdata=1.8*length($elementdata);  
     if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;}      if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;}
  }   }
     } else {      } else {
  $current_length=1.8*length($data);   $current_length=1.8*LATEX_length($data);
     }      }
     $Apache::londefdef::table[-1]{'length'} .= $current_length.',';      $Apache::londefdef::table[-1]{'length'} .= $current_length.',';
     $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';      $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';
Line 2163  sub start_img { Line 2159  sub start_img {
     my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";      my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
     $temp_file = Apache::File->new('>>'.$filename);       $temp_file = Apache::File->new('>>'.$filename); 
     print $temp_file "$src\n";      print $temp_file "$src\n";
     $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool/}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';      $newsrc=~s/\/home\/httpd\/html\/res//;
       $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//;
       $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
  }   }
     }      }
  } else {   } else {
Line 3330  sub recalc { Line 3328  sub recalc {
     return $value.' mm';      return $value.' mm';
 }  }
   
   sub LATEX_length {
       my $garbage=shift;
       $garbage=~s/^\s+(\S.*)/$1/; 
       $garbage=~s/(.*\S)\s+$/$1/;
       $garbage=~s/(\s)+/$1/;
       $garbage=~s/(\\begin{([^\}]+)}|\\end{([^\}]+)})//g;
       $garbage=~s/(\$\_\{|\$\_|\$\^{|\$\^|\}\$|\$)//g;
       $garbage=~s/(\\alpha|\\beta|\\gamma|\\delta|\\epsilon|\\verepsilon|\\zeta|\\eta|\\theta|\\vartheta|\\iota|\\kappa|\\lambda|\\mu|\\nu|\\xi|\\pi|\\varpi|\\rho|\\varrho|\\sigma|\\varsigma|\\tau|\\upsilon|\\phi|\\varphi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega)/1/g;
       $garbage=~s/(\\pm|\\mp|\\times|\\div|\\cdot|\\ast|\\star|\\dagger|\\ddagger|\\amalg|\\cap|\\cup|\\uplus|\\sqcap|\\sqcup|\\vee|\\wedge|\\oplus|\\ominus|\\otimes|\\circ|\\bullet|\\diamond|\\lhd|\\rhd|\\unlhd|\\unrhd|\\oslash|\\odot|\\bigcirc|\\Box|\\Diamond|\\bigtriangleup|\\bigtriangledown|\\triangleleft|\\triangleright|\\setminus|\\wr)/1/g;
       $garbage=~s/(\\le|\\ll|\\leq|\\ge|\\geq|\\gg|\\neq|\\doreq|\\sim|\\simeq|\\subset|\\subseteq|\\sqsubset|\\sqsubseteq|\\in|\\vdash|\\models|\\supset|\\supseteq|\\sqsupset|\\sqsupseteq|\\ni|\\dash|\\perp|\\approx|\\cong|\\equiv|\\propto|\\prec|\\preceq|\\parallel|\\asymp|\\smile|\\frown|\\bowtie|\\succ|\\succeq|\\mid)/1/g;
       $garbage=~s/(\\not<|\\\\not\\le|\\not\\prec|\\not\\preceq|\\not\\subset|\\not\\subseteq|\\not\\sqsubseteq|\\not\\in|\\not>|\\not\\ge|\\not\\succ|\\notsucceq|\\not\\supset|\\notsupseteq|\\not\\sqsupseteq|\\notin|\\not=|\\not\\equiv|\\not\\sim|\\not\\simeq|\\not\\approx|\\not\\cong|\\not\\asymp)/1/g;
       $garbage=~s/(\\leftarrow|\\gets|\\Leftarrow|\\rightarrow|\\to|\\Rightarrow|\\leftrightarrow|\\Leftrightarrow|\\mapsto|\\hookleftarrow|\\leftharpoonup|\\leftkarpoondown|\\rightleftharpoons|\\longleftarrow|\\Longleftarrow|\\longrightarrow|\\Longrightarrow|\\longleftrightarrow|\\Longleftrightarrow|\\longmapsto|\\hookrightarrow|\\rightharpoonup|\\rightharpoondown|\\uparrow|\\Uparrow|\\downarrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\nearrow|\\searrow|\\swarrow|\\nwarrow)/1/g;
       $garbage=~s/(\\aleph|\\hbar|\\imath|\\jmath|\\ell|\\wp|\\Re|\\Im|\\mho|\\prime|\\emptyset|\\nabla|\\surd|\\partial|\\top|\\bot|\\vdash|\\dashv|\\forall|\\exists|\\neg|\\flat|\\natural|\\sharp|\\\||\\angle|\\backslash|\\Box|\\Diamond|\\triangle|\\clubsuit|\\diamondsuit|\\heartsuit|\\spadesuit|\\Join|\\infty)/ /g;
       $garbage=~s/(\\hat{([^}]+)}|\\check{([^}]+)}|\\dot{([^}]+)}|\\breve{([^}]+)}|\\acute{([^}]+)}|\\ddot{([^}]+)}|\\grave{([^}]+)}|\\tilde{([^}]+)}|\\mathring{([^}]+)}|\\bar{([^}]+)}|\\vec{([^}]+)})/$1/g; 
       my  $value=length($garbage);
       return $value;
   }
   
   
   
   
 1;  1;
 __END__  __END__

Removed from v.1.181  
changed lines
  Added in v.1.185


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