version 1.406, 2005/12/15 18:36:23
|
version 1.409, 2005/12/19 22:30:01
|
Line 750 sub details_for_menu {
|
Line 750 sub details_for_menu {
|
|
|
|
|
sub latex_corrections { |
sub latex_corrections { |
|
my ($number_of_columns,$result,$selectionmade,$answer_mode) = @_; |
my ($number_of_columns,$result,$selectionmade) = @_; |
|
|
|
# $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g; |
# $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g; |
$result =~ s/\$number_of_columns/$number_of_columns/g; |
$result =~ s/\$number_of_columns/$number_of_columns/g; |
if ($selectionmade ne '1') { |
if ($selectionmade eq '1' || $answer_mode eq 'only') { |
$result =~ s/(\\end{document})/\\strut\\vspace\*{-4 mm}\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License $1/; |
$result =~ s/(\\end{document})/\\strut\\vskip 0 mm\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License $1/; |
} else { |
} else { |
$result =~ s/(\\end{document})/\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License $1/; |
$result =~ s/(\\end{document})/\\strut\\vspace\*{-4 mm}\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License $1/; |
} |
} |
$result =~ s/(\\end{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g; |
$result =~ s/(\\end{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g; |
$result =~ s/(\\end{longtable}\s*)\\strut\\newline/$1/g; |
$result =~ s/(\\end{longtable}\s*)\\strut\\newline/$1/g; |
Line 817 sub IndexCreation {
|
Line 816 sub IndexCreation {
|
|
|
sub print_latex_header { |
sub print_latex_header { |
my $mode=shift; |
my $mode=shift; |
my $output='\documentclass[letterpaper]{article}'; |
my $output='\documentclass[letterpaper,twoside]{article}'; |
if (($mode eq 'batchmode') || (!$perm{'pav'})) { |
if (($mode eq 'batchmode') || (!$perm{'pav'})) { |
$output.='\batchmode'; |
$output.='\batchmode'; |
} |
} |
Line 1257 ENDPART
|
Line 1256 ENDPART
|
$result.="\\newpage\n"; |
$result.="\\newpage\n"; |
} |
} |
} |
} |
my (undef,undef,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]); |
my ($sequence,undef,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]); |
$urlp=&Apache::lonnet::clutter($urlp); |
$urlp=&Apache::lonnet::clutter($urlp); |
$form{'symb'}=$master_seq[$i]; |
$form{'symb'}=$master_seq[$i]; |
my ($sequence)=&Apache::lonnet::decode_symb($master_seq[$i]); |
|
my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #tittle of the assignment which contains this problem |
my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem |
if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;} |
if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;} |
if ($i==0) {$prevassignment=$assignment;} |
if ($i==0) {$prevassignment=$assignment;} |
my $texversion=''; |
my $texversion=''; |
Line 1294 ENDPART
|
Line 1293 ENDPART
|
} else { |
} else { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library)$/) { |
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library)$/) { |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); |
$texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($urlp).'}\vskip 0 mm '; |
$texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($master_seq[$i]).'}\vskip 0 mm '; |
$texversion.=&path_to_problem ($urlp,$LaTeXwidth); |
$texversion.=&path_to_problem ($urlp,$LaTeXwidth); |
$texversion.='\vskip 1 mm '.$answer; |
$texversion.='\vskip 1 mm '.$answer; |
} else { |
} else { |
Line 1402 ENDPART
|
Line 1401 ENDPART
|
$person,$type, |
$person,$type, |
\%moreenv,\@master_seq, |
\%moreenv,\@master_seq, |
$flag_latex_header_remove, |
$flag_latex_header_remove, |
$LaTeXwidth); |
$LaTeXwidth, |
|
$number_of_columns); |
$resources_printed .= ":"; |
$resources_printed .= ":"; |
$print_array[$i].=$output; |
$print_array[$i].=$output; |
$student_names[$i].=$person.':'.$fullname.'_END_'; |
$student_names[$i].=$person.':'.$fullname.'_END_'; |
Line 1578 ENDPART
|
Line 1578 ENDPART
|
} |
} |
#-------------------------------------------------------- corrections for the different page formats |
#-------------------------------------------------------- corrections for the different page formats |
$result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade); |
$result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade); |
$result = &latex_corrections($number_of_columns,$result,$selectionmade); |
$result = &latex_corrections($number_of_columns,$result,$selectionmade, |
for (my $i=1;$i<=$#print_array;$i++) {$print_array[$i] = &latex_corrections($number_of_columns,$print_array[$i],$selectionmade);} |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
|
for (my $i=1;$i<=$#print_array;$i++) { |
|
$print_array[$i] = |
|
&latex_corrections($number_of_columns,$print_array[$i], |
|
$selectionmade, |
|
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
|
} |
#changes page's parameters for the one column output |
#changes page's parameters for the one column output |
if ($numberofcolumns == 1) { |
if ($numberofcolumns == 1) { |
$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; |
$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; |
Line 1701 sub get_CODE {
|
Line 1707 sub get_CODE {
|
|
|
sub print_resources { |
sub print_resources { |
my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header, |
my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header, |
$LaTeXwidth)=@_; |
$LaTeXwidth,$number_of_columns)=@_; |
my $current_output = ''; |
my $current_output = ''; |
my $printed = ''; |
my $printed = ''; |
my ($username,$userdomain,$usersection) = split /:/,$person; |
my ($username,$userdomain,$usersection) = split /:/,$person; |
Line 1767 sub print_resources {
|
Line 1773 sub print_resources {
|
$printed .= $curresline.':'; |
$printed .= $curresline.':'; |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my ($envfile) = |
my ($envfile) = |
( $env{'user.environment'} = ~m|/([^/]+)\.id$| ); |
( $env{'user.environment'} =~ m|/([^/]+)\.id$| ); |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
$envfile); |
$envfile); |
my $current_counter=$env{'form.counter'}; |
my $current_counter=$env{'form.counter'}; |
Line 1776 sub print_resources {
|
Line 1782 sub print_resources {
|
} else { |
} else { |
$rendered =~ s/\\end{document}//; |
$rendered =~ s/\\end{document}//; |
} |
} |
$current_output .= $rendered.'\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\strut \vskip 0 mm \strut '; |
$current_output .= $rendered.'\vskip 0.5mm\noindent\makebox[\textwidth/'.$number_of_columns.'][b]{\hrulefill}\strut \vskip 0 mm \strut '; |
} else { |
} else { |
my $rendered = &unsupported($res_url,$helper->{'VARS'}->{'LATEX_TYPE'}); |
my $rendered = &unsupported($res_url,$helper->{'VARS'}->{'LATEX_TYPE'}); |
if ($remove_latex_header ne 'NO') { |
if ($remove_latex_header ne 'NO') { |