version 1.33, 2002/06/21 19:52:13
|
version 1.34, 2002/06/27 18:47:59
|
Line 46 use Apache::lonnet;
|
Line 46 use Apache::lonnet;
|
use Apache::inputtags; |
use Apache::inputtags; |
use Apache::edit; |
use Apache::edit; |
use Apache::File(); |
use Apache::File(); |
|
use POSIX qw(strftime); |
|
|
|
|
sub headerform { |
sub headerform { |
Line 112 ENDPART
|
Line 112 ENDPART
|
my $layout = $ENV{'form.layout'}; |
my $layout = $ENV{'form.layout'}; |
my $laystyle = 'book'; |
my $laystyle = 'book'; |
my $result = ''; |
my $result = ''; |
|
my $number_of_columns = 1; |
|
|
if ($choice eq 'Standard LaTeX output for current document') { |
if ($choice eq 'Standard LaTeX output for current document') { |
my %moreenv; |
my %moreenv; |
Line 122 ENDPART
|
Line 123 ENDPART
|
&Apache::lonnet::delenv('form.grade_target'); |
&Apache::lonnet::delenv('form.grade_target'); |
$result .= $texversion; |
$result .= $texversion; |
$result = &additional_cleanup($result); |
$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') { |
} 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? |
#-- where is the primary sequence containing file? |
my %moreenv; |
my %moreenv; |
Line 239 ENDPART
|
Line 240 ENDPART
|
$_ = $courseidinfo; |
$_ = $courseidinfo; |
m/.*\/(.*)/; |
m/.*\/(.*)/; |
$courseidinfo = $ENV{'course.physnet_'.$1.'.description'}; |
$courseidinfo = $ENV{'course.physnet_'.$1.'.description'}; |
$result =~ s/\\documentclass\[letterpaper\]{article}/\\documentclass\[twocolumn\]{article}/; |
# $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{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/\\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{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 |
#-- LaTeX corrections |
my $first_comment = index($result,'<!--',0); |
my $first_comment = index($result,'<!--',0); |
Line 292 sub page_cleanup {
|
Line 296 sub page_cleanup {
|
my $result = shift; |
my $result = shift; |
$_ = $result; |
$_ = $result; |
m/\\end{document}(\d*)$/; |
m/\\end{document}(\d*)$/; |
|
my $number_of_columns = $1; |
my $insert = '{'; |
my $insert = '{'; |
for (my $id=1;$id<=$1;$id++) { $insert .='l'; } |
for (my $id=1;$id<=$number_of_columns;$id++) { $insert .='l'; } |
$insert .= '}'; |
$insert .= '}'; |
$result =~ s/(\\begin{tabular})INSERT/$1$insert/g; |
$result =~ s/(\\begin{longtable})INSERTTHEHEADOFLONGTABLE/$1$insert/g; |
$result =~ s/&\s*REMOVE\\\\/\\end{tabular}\\\\\\begin{tabular}$insert/g; |
$result =~ s/&\s*REMOVETHEHEADOFLONGTABLE\\\\/\\\\/g; |
return $result; |
$result =~ s/(\\vskip\s*\d+\s*mm)/}\\\\\\parbox{\\minipagewidth}{/g; |
|
return $result,$number_of_columns; |
} |
} |
|
|
sub content_map { |
sub content_map { |