Diff for /doc/help/texxml2latex.pl between versions 1.10 and 1.11

version 1.10, 2004/09/14 21:18:44 version 1.11, 2004/09/14 22:26:17
Line 44  my $tmpdir = File::Temp::tempdir('loncap Line 44  my $tmpdir = File::Temp::tempdir('loncap
 open (LATEX_FILE, $dirprefix . "Latex_Header.tex");  open (LATEX_FILE, $dirprefix . "Latex_Header.tex");
 print <LATEX_FILE>;  print <LATEX_FILE>;
   
   sub escape_latex {
       my ($string)=@_;
       $string=~s/\\/\\ensuremath{\\backslash}/g;
       $string=~s/([^\\]|^)\%/$1\\\%/g;
       $string=~s/([^\\]|^)\$/$1\\\$/g;
       $string=~s/([^\\])\_/$1\\_/g;
       $string=~s/\$\$/\$\\\$/g;
       $string=~s/\_\_/\_\\\_/g;
       $string=~s/\#\#/\#\\\#/g;
       $string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g;
       $string=~s/(>|<)/\\ensuremath\{$1\}/g; #more or less
   #    $string=&Apache::lonprintout::character_chart($string);
       # any & or # leftover should be safe to just escape
       $string=~s/([^\\]|^)\&/$1\\\&/g;
       $string=~s/([^\\]|^)\#/$1\\\#/g;
       $string=~s/\|/\$\\mid\$/g;
       return $string;
   }
   
 while (my $token = $p->get_token())  while (my $token = $p->get_token())
 {  {
     my $type = $token->[0];      my $type = $token->[0];
Line 52  while (my $token = $p->get_token()) Line 71  while (my $token = $p->get_token())
  my $attr = $token->[2];   my $attr = $token->[2];
  if ($tag eq 'section') {   if ($tag eq 'section') {
     my $title = $attr->{'name'};      my $title = $attr->{'name'};
     print "\\section{$title}\n\n";      print "\\section{".&escape_latex($title)."}\n\n";
  }   }
   
  if ($tag eq 'subsection') {   if ($tag eq 'subsection') {
     my $title = $attr->{'name'};      my $title = $attr->{'name'};
     print "\\subsection{$title}\n\n";      print "\\subsection{"&escape_latex($title)."}\n\n";
  }   }
   
  if ($tag eq 'subsubsection') {   if ($tag eq 'subsubsection') {
     my $title = $attr->{'name'};      my $title = $attr->{'name'};
     print "\\subsubsection{$title}\n\n";      print "\\subsubsection{".&escape_latex($title)."}\n\n";
  }   }
   
  if ($tag eq 'file') {   if ($tag eq 'file') {
     my $file = $attr->{'name'};      my $file = $attr->{'name'};
     open (LATEX_FILE, $dirprefix . $file) or       open (LATEX_FILE, $dirprefix . $file) or 
  ($! = 1, die "Can't find LaTeX file $dirprefix/$file; terminating build.");   ($! = 1, die "Can't find LaTeX file $dirprefix/$file; terminating build.");
     my $esc_file=$file;  
     $esc_file=~s/_/\\_/g;  
     if ($include_filenames) {      if ($include_filenames) {
  print "\\textrm{File: \\bf $esc_file}\\\\\n";   print "\\textrm{File: \\bf ".&escape_latex($file)."}\\\\\n";
     }      }
     print <LATEX_FILE>;      print <LATEX_FILE>;
     print "\n\n";      print "\n\n";

Removed from v.1.10  
changed lines
  Added in v.1.11


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