Diff for /loncom/interface/lonprintout.pm between versions 1.472 and 1.481

version 1.472, 2006/08/01 18:46:07 version 1.481, 2006/08/22 14:43:49
Line 827  sub details_for_menu { Line 827  sub details_for_menu {
     return ($name_of_resource,$name_of_sequence,$name_of_map);      return ($name_of_resource,$name_of_sequence,$name_of_map);
 }  }
   
   sub copyright_line {
       return '\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\vspace*{-2 mm}\newline\noindent{\tiny Printed from LON-CAPA\copyright MSU{\hfill} Licensed under GNU General Public License } ';
   }
   my $end_of_student = "\n".'\special{ps:ENDOFSTUDENTSTAMP}'."\n";
   
 sub latex_corrections {  sub latex_corrections {
     my ($number_of_columns,$result,$selectionmade,$answer_mode) = @_;      my ($number_of_columns,$result,$selectionmade,$answer_mode) = @_;
 #    $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g;  #    $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g;
     $result =~ s/\$number_of_columns/$number_of_columns/g;      my $copyright = &copyright_line();
     if ($selectionmade eq '1' || $answer_mode eq 'only') {      if ($selectionmade eq '1' || $answer_mode eq 'only') {
  $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/;   $result =~ s/(\\end{document})/\\strut\\vskip 0 mm $copyright $end_of_student $1/;
     } else {      } else {
  $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\\vspace\*{-4 mm}\\newline $copyright $end_of_student $1/;
     }      }
       $result =~ s/\$number_of_columns/$number_of_columns/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\\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;
 #-- LaTeX corrections       #-- LaTeX corrections     
Line 893  sub IndexCreation { Line 898  sub IndexCreation {
   
 sub print_latex_header {  sub print_latex_header {
     my $mode=shift;      my $mode=shift;
     my $output='\documentclass[letterpaper,twoside]{article}';      my $output='\documentclass[letterpaper,twoside]{article}\raggedbottom';
     if (($mode eq 'batchmode') || (!$perm{'pav'})) {      if (($mode eq 'batchmode') || (!$perm{'pav'})) {
  $output.='\batchmode';   $output.='\batchmode';
     }      }
Line 1114  sub print_construction_sequence { Line 1119  sub print_construction_sequence {
     # If necessary, encapsulate answer in minipage:      # If necessary, encapsulate answer in minipage:
           
     $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});      $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
     my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm ';      my $title = &Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'});
       $title = &Apache::lonxml::latex_special_symbols($title);
       my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
     $body.=&path_to_problem($urlp,$LaTeXwidth);      $body.=&path_to_problem($urlp,$LaTeXwidth);
     $body.='\vskip 1 mm '.$answer.'\end{document}';      $body.='\vskip 1 mm '.$answer.'\end{document}';
     $body = &encapsulate_minipage($body);      $body = &encapsulate_minipage($body);
Line 1309  ENDPART Line 1316  ENDPART
  } else {   } else {
     $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});      $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
     if ($helper->{'VARS'}->{'construction'} ne '1') {      if ($helper->{'VARS'}->{'construction'} ne '1') {
  $texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm ';   my $title = &Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'});
    $title = &Apache::lonxml::latex_special_symbols($title);
    $texversion.='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
  $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);   $texversion.=&path_to_problem($cleanURL,$LaTeXwidth);
     } else {      } else {
  $texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';   $texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
Line 1430  ENDPART Line 1439  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'});
     my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($master_seq[$i]).'}\vskip 0 mm ';      my $title = &Apache::lonnet::gettitle($master_seq[$i]);
       $title = &Apache::lonxml::latex_special_symbols($title);
       my $body ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
     $body   .= &path_to_problem ($urlp,$LaTeXwidth);      $body   .= &path_to_problem ($urlp,$LaTeXwidth);
     $body   .='\vskip 1 mm '.$answer;      $body   .='\vskip 1 mm '.$answer;
     $body    = &encapsulate_minipage($body);      $body    = &encapsulate_minipage($body);
Line 1754  ENDPART Line 1765  ENDPART
     $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,
  $helper->{'VARS'}->{'ANSWER_TYPE'});   $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'});  
     }  
     #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'} /;
  $result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;   $result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
Line 1786  ENDPART Line 1791  ENDPART
     if ($i==0) {      if ($i==0) {
  $print_array[$i]=$result;   $print_array[$i]=$result;
     } else {      } else {
    $print_array[$i].='\end{document}';
    $print_array[$i] = 
       &latex_corrections($number_of_columns,$print_array[$i],
          $selectionmade, 
          $helper->{'VARS'}->{'ANSWER_TYPE'});
   
  my $anobegin=index($print_array[$i],'\setcounter{page}',0);   my $anobegin=index($print_array[$i],'\setcounter{page}',0);
  substr($print_array[$i],0,$anobegin)='';   substr($print_array[$i],0,$anobegin)='';
  $print_array[$i]=$inc.$print_array[$i].'\end{document}';   $print_array[$i]=$inc.$print_array[$i];
     }      }
     my $temp_file;      my $temp_file;
     my $newfilename=$filename;      my $newfilename=$filename;
Line 1899  sub print_resources { Line 1910  sub print_resources {
   
     &Apache::lonxml::clear_problem_counter();      &Apache::lonxml::clear_problem_counter();
     my %page_breaks  = &get_page_breaks($helper);      my %page_breaks  = &get_page_breaks($helper);
     my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'});      my $columns_in_format = (split(/\|/,$helper->{'VARS'}->{'FORMAT'}))[1];
     my $columns_in_format = $format_array[1];  
     #      #
     #   end each student with a       #   end each student with a 
     #   Special that allows the post processor to even out the page      #   Special that allows the post processor to even out the page
Line 1948  sub print_resources { Line 1958  sub print_resources {
   
           
     my $header =&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});      my $header =&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
     my $body   ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm ';      my $title = &Apache::lonnet::gettitle($curresline);
     $body     .=&path_to_problem($res_url,$LaTeXwidth);          $title = &Apache::lonxml::latex_special_symbols($title);
       my $body   ='\vskip 0 mm \noindent\textbf{'.$title.'}\vskip 0 mm ';
       $body     .=&path_to_problem($res_url,$LaTeXwidth);
     $body     .='\vskip 1 mm '.$ansrendered;      $body     .='\vskip 1 mm '.$ansrendered;
     $body     = &encapsulate_minipage($body);      $body     = &encapsulate_minipage($body);
     $rendered = $header.$body;      $rendered = $header.$body;
Line 1990  sub print_resources { Line 2002  sub print_resources {
     if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }      if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
     if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection}      if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection}
     my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');      my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
     my $HeaderLine = $parmhash{'print_header_format'};      my $header_line =
     $HeaderLine = format_page_header($HeaderLine, $currentassignment, $courseidinfo, $fullname);   &format_page_header($parmhash{'print_header_format'},
     if ($current_output=~/\\documentclass/) {      $currentassignment, $courseidinfo, $fullname);
  if ($columns_in_format == 1) {      my $header_start = ($columns_in_format == 1) ? '\lhead'
     $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{$HeaderLine$namepostfix}}\\vskip 5 mm /;                                           : '\fancyhead[LO]';
  } else {      $header_line = $header_start.'{'.$header_line.'}';
         $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{$HeaderLine$namepostfix}}\\vskip 5 mm /;  
   
  }      if ($current_output=~/\\documentclass/) {
    $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$header_line$namepostfix}\\vskip 5 mm /;
     } else {      } else {
  my $blankpages = '';   my $blankpages = 
  for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';}      '\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'};
  if ($columns_in_format == 1) {      
     $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output;   $current_output = '\strut\vspace*{-6 mm}\\newline'.
  } else {      &copyright_line().' \newpage '.$blankpages.$end_of_student.
    $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output;      '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'.
  }      $header_line.$namepostfix.'} \vskip 5 mm '.$current_output;
     }      }
     #      #
     #  Close the student bracketing.      #  Close the student bracketing.
     #      #
     $current_output .= "\n\\special{ps:ENDOFSTUDENTSTAMP}\n";  
     return ($current_output,$fullname, $printed);      return ($current_output,$fullname, $printed);
   
 }  }
Line 2318  ALL_PROBLEMS Line 2329  ALL_PROBLEMS
   
  if ($helper->{VARS}->{'assignment'}) {   if ($helper->{VARS}->{'assignment'}) {
     push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>selected students</b>",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];      push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>selected students</b>",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];
     push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>CODEd assinments</b>",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];      push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>CODEd assignments</b>",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];
  }   }
   
  # resource_selector will hold a few states that:   # resource_selector will hold a few states that:

Removed from v.1.472  
changed lines
  Added in v.1.481


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