--- loncom/interface/lonprintout.pm 2005/02/09 15:56:45 1.359 +++ loncom/interface/lonprintout.pm 2005/02/10 21:05:03 1.360 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.359 2005/02/09 15:56:45 www Exp $ +# $Id: lonprintout.pm,v 1.360 2005/02/10 21:05:03 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,9 +42,6 @@ use Apache::lonratedt; use POSIX qw(strftime); use Apache::lonlocal; -my $LaTeXwidth = 0; - - # Compare two students by name. The students are in the form # returned by the helper: # user:domain:section:last, first:status @@ -726,7 +723,7 @@ sub path_to_problem { my $newurlp = ''; $colwidth=~s/\s*mm\s*$//; #characters average about 2 mm in width - if (length($urlp)*2 > $LaTeXwidth) { + if (length($urlp)*2 > $colwidth) { my @elements = split '/',$urlp; my $curlength=0; foreach my $element (@elements) { @@ -824,15 +821,6 @@ $bodytag Please stand by while processing your print request, this may take some time ... ENDPART - # Common settings for the %form has: - # In some cases these settings get overriddent by specific cases, but the - # settings are common enough to make it worthwhile factoring them out - # here. - # - my %form; - $form{'grade_target'} = 'tex'; - $form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth); - my $format_from_helper = $helper->{'VARS'}->{'FORMAT'}; my ($result,$selectionmade) = ('',''); my $number_of_columns = 1; #used only for pages to determine the width of the cell @@ -848,6 +836,15 @@ ENDPART my $LaTeXwidth=&recalcto_mm($textwidth); my @print_array=(); my @student_names=(); + + # Common settings for the %form has: + # In some cases these settings get overriddent by specific cases, but the + # settings are common enough to make it worthwhile factoring them out + # here. + # + my %form; + $form{'grade_target'} = 'tex'; + $form{'textwidth'} = &get_textwidth($helper, $LaTeXwidth); if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { #-- single document - problem, page, html, xml, ... @@ -1172,7 +1169,8 @@ ENDPART my ($output,$fullname)=&print_resources($r,$helper, $person,$type, \%moreenv,\@master_seq, - $flag_latex_header_remove); + $flag_latex_header_remove, + $LaTeXwidth); $print_array[$i].=$output; $student_names[$i].=$person.':'.$fullname.'_END_'; &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname); @@ -1223,7 +1221,8 @@ ENDPART $moreenv{'CODE'}=&num_to_letters($code); my ($output,$fullname)= &print_resources($r,$helper,'anonymous',$type,\%moreenv, - \@master_seq,$flag_latex_header_remove); + \@master_seq,$flag_latex_header_remove, + $LaTeXwidth); $print_array[$file_num].=$output; &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, &mt('last assignment').' '.$fullname); @@ -1420,7 +1419,8 @@ sub get_CODE { } 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)=@_; my $current_output = ''; my ($username,$userdomain,$usersection) = split /:/,$person; my $fullname = &get_name($username,$userdomain);