[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Thu, 27 Jun 2002 18:47:59 -0000
sakharuk Thu Jun 27 14:47:59 2002 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
See comments for structuretags.pm
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.33 loncom/interface/lonprintout.pm:1.34
--- loncom/interface/lonprintout.pm:1.33 Fri Jun 21 15:52:13 2002
+++ loncom/interface/lonprintout.pm Thu Jun 27 14:47:59 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.33 2002/06/21 19:52:13 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.34 2002/06/27 18:47:59 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,7 +46,7 @@
use Apache::inputtags;
use Apache::edit;
use Apache::File();
-
+use POSIX qw(strftime);
sub headerform {
@@ -112,6 +112,7 @@
my $layout = $ENV{'form.layout'};
my $laystyle = 'book';
my $result = '';
+ my $number_of_columns = 1;
if ($choice eq 'Standard LaTeX output for current document') {
my %moreenv;
@@ -122,7 +123,7 @@
&Apache::lonnet::delenv('form.grade_target');
$result .= $texversion;
$result = &additional_cleanup($result);
- if ($ENV{'form.url'}=~m/\.page\s*$/) {$result = &page_cleanup($result);}
+ if ($ENV{'form.url'}=~m/\.page\s*$/) {($result,$number_of_columns) = &page_cleanup($result);}
} elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') {
#-- where is the primary sequence containing file?
my %moreenv;
@@ -239,10 +240,13 @@
$_ = $courseidinfo;
m/.*\/(.*)/;
$courseidinfo = $ENV{'course.physnet_'.$1.'.description'};
- $result =~ s/\\documentclass\[letterpaper\]{article}/\\documentclass\[twocolumn\]{article}/;
- $result =~ s/\\begin{document}/\\textheight 25\.9cm\\oddsidemargin = -0\.57in\\evensidemargin = -0\.57in\\textwidth= 7\.7in\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/2-0\.2in}\\renewcommand{\\ref}{\\keephidden\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}}\\hskip 1\.4in $courseidinfo \\vskip 5 mm /;
+# $result =~ s/\\documentclass\[letterpaper\]{article}/\\documentclass\[twocolumn\]{article}/;
+ $result =~ s/\\documentclass\[letterpaper\]{article}/\\documentclass{article}/;
+ $result =~ s/\\begin{document}/\\textheight 25\.9cm\\oddsidemargin = -0\.57in\\evensidemargin = -0\.57in\\textwidth= 9cm\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\begin{document}\\voffset=-1\.8cm\\setcounter{page}{1}\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}}\\hskip 1\.4in $courseidinfo} \\vskip 5 mm /;
$result =~ s/\\includegraphics{/\\includegraphics\[width=9\.0 cm\]{/g;
$result =~ s/(\\end{document})/\\newline\\noindent\\makebox\[9.0cm\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Dept\. of Physics and Astronomy, MSU\\makebox\[1.5cm\]\[b\]{\\hfill}LON-CAPA\\copyright MSU GNU\/GPL $1/;
+ $result =~ s/(\\end{longtable}\s*)(\\newline\\noindent\\makebox\[9\.0cm\]\[b\]{\\hrulefill})/$2$1/g;
+ $result =~ s/(\\end{longtable}\s*)\\newline/$1/g;
}
#-- LaTeX corrections
my $first_comment = index($result,'<!--',0);
@@ -292,12 +296,14 @@
my $result = shift;
$_ = $result;
m/\\end{document}(\d*)$/;
+ my $number_of_columns = $1;
my $insert = '{';
- for (my $id=1;$id<=$1;$id++) { $insert .='l'; }
+ for (my $id=1;$id<=$number_of_columns;$id++) { $insert .='l'; }
$insert .= '}';
- $result =~ s/(\\begin{tabular})INSERT/$1$insert/g;
- $result =~ s/&\s*REMOVE\\\\/\\end{tabular}\\\\\\begin{tabular}$insert/g;
- return $result;
+ $result =~ s/(\\begin{longtable})INSERTTHEHEADOFLONGTABLE/$1$insert/g;
+ $result =~ s/&\s*REMOVETHEHEADOFLONGTABLE\\\\/\\\\/g;
+ $result =~ s/(\\vskip\s*\d+\s*mm)/}\\\\\\parbox{\\minipagewidth}{/g;
+ return $result,$number_of_columns;
}
sub content_map {