[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm printout.pl
raeburn
raeburn at source.lon-capa.org
Thu Oct 31 20:08:03 EDT 2024
raeburn Fri Nov 1 00:08:03 2024 EDT
Modified files:
/loncom/interface lonprintout.pm printout.pl
Log:
- Bug 6819
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.697 loncom/interface/lonprintout.pm:1.698
--- loncom/interface/lonprintout.pm:1.697 Tue Oct 29 22:00:23 2024
+++ loncom/interface/lonprintout.pm Fri Nov 1 00:08:03 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.697 2024/10/29 22:00:23 raeburn Exp $
+# $Id: lonprintout.pm,v 1.698 2024/11/01 00:08:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1865,7 +1865,7 @@
},
'album' => {
'1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.55 in','0.394 in'],
- '2' => [ '4.8 in', '6.8 in','-0.5 in', '-1.0 in','3.5 in']
+ '2' => [ '4.8 in', '6.8 in','-0.5 in', '-1.0 in','3.0 in']
},
},
'legal' => {
@@ -1925,7 +1925,7 @@
},
'album' => {
'1' => ['21.59 cm','19.558 cm','-1.397cm','-2.11 cm','0 cm'],
- '2' => ['9.91 cm','19.558 cm','-1.397 cm','-2.11 cm','0 cm']
+ '2' => ['9.91 cm','19.558 cm','-1.397 cm','-2.11 cm','-1 cm']
},
},
'a5' => {
@@ -2012,23 +2012,46 @@
} else {
$fancypagestatement="\\rhead{}\\chead{}\\lhead{$header_text}";
}
+ my ($paperwidth,$paperheight);
if ($layout eq 'album') {
$text =~ s/\\begin\{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\n\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\n\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\n\\pagestyle{fancy}$fancypagestatement\\usepackage{booktabs}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}\n /;
+ if ($papersize eq 'a4') {
+ $paperwidth = '29.7cm';
+ $paperheight = '21cm';
+ } elsif ($numberofcolumns eq '1') {
+ if ($papersize eq 'letter') {
+ $paperwidth = '11in';
+ $paperheight = '8.5in';
+ } elsif ($papersize eq 'legal') {
+ $paperwidth = '14in';
+ $paperheight = '8.5in';
+ }
+ }
} elsif ($layout eq 'book') {
if ($choice ne 'All class print') {
$text =~ s/\\begin\{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset $topmargintoinsert\n\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\n\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\\pagestyle{fancy}$fancypagestatement\\usepackage{booktabs}\\begin{document}\n\\voffset=-0\.8 cm\\setcounter{page}{1}\n/;
} else {
$text =~ s/\\pagestyle\{fancy}\\rhead\{}\\chead\{}\s*\\begin\{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\n\\evensidemargin = $evenoffset $topmargintoinsert\\textwidth= $textwidth\\newlength{\\minipagewidth}\n\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\usepackage{booktabs}\\begin{document}\\voffset=-0\.8cm\n\\setcounter{page}{1} \\vskip 5 mm\n /;
}
- if ($papersize eq 'a4') {
- my $papersize_text;
- if ($perm{'pav'}) {
- $papersize_text = '\\special{papersize=210mm,297mm}';
- } else {
- $papersize_text = '\special{papersize=210mm,297mm}';
- }
- $text =~ s/(\\begin\{document})/$1$papersize_text/;
- }
+ if ($papersize eq 'a4') {
+ $paperwidth = '21cm';
+ $paperheight = '29.7cm';
+ } elsif ($papersize eq 'letter') {
+ $paperwidth = '8.5in';
+ $paperheight = '11.5in';
+ } elsif ($papersize eq 'legal') {
+ $paperwidth = '8.5in';
+ $paperheight = '14.0in';
+ }
+ }
+ if ($paperwidth ne '' && $paperheight ne '') {
+ my $papersize_text;
+ if ($perm{'pav'}) {
+ $papersize_text = '\\special{papersize='.$paperwidth.','.$paperheight.'}';
+ } else {
+ $papersize_text = '\special{papersize='.$paperwidth.','.$paperheight.'}';
+ }
+ $text =~ s/(\\begin\{document})/$1$papersize_text/;
}
if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}
if ($indexlist eq 'yes') {
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.175 loncom/interface/printout.pl:1.176
--- loncom/interface/printout.pl:1.175 Mon Oct 21 19:32:10 2024
+++ loncom/interface/printout.pl Fri Nov 1 00:08:03 2024
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.175 2024/10/21 19:32:10 raeburn Exp $
+# $Id: printout.pl,v 1.176 2024/11/01 00:08:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -448,7 +448,7 @@
# Explicitly include a switch for papertype, otherwise dvips will default
# to whatever is listed first in config.ps (which in most cases is a4).
my $papera;
- unless ($paper eq '') {
+ unless (($paper eq '') || (($laystyle eq 'album') && ($numberofcolumns eq '1'))) {
$papera='-t'.$paper;
}
my $extra_ps_header = $perlvar{'lonLib'} .'/includepsheader.ps';
@@ -505,7 +505,9 @@
$new_name_file =~ m/^(.*)\./;
my $ps_file = my $tempo_file = $1.'temporar.ps';
my $pdf_file = $1.'.pdf';
- $papera=~s/t/p/;
+ unless ($paper eq '') {
+ $papera='-p'.$paper;
+ }
#----
# The code below uses fixps to make pdf include in sequences work.
#
@@ -567,7 +569,24 @@
}
}
if ($laystyle eq 'album' and $numberofcolumns eq '2') {
- $comma = "psnup $papera -2 -s1.0 $new_name_file";
+ my $canscale;
+ if (open(PIPE,"psnup --version 2>&1 |")) {
+ while (<PIPE>) {
+ chomp();
+ if (/^psnup\s+release\s+(\d+)/) {
+ if ($1 < 2) {
+ $canscale = 1;
+ }
+ last;
+ }
+ }
+ close(PIPE);
+ }
+ if ($canscale) {
+ $comma = "psnup $papera -2 -s1.0 $new_name_file";
+ } else {
+ $comma = "psnup $papera -2 $new_name_file";
+ }
&debug("PSNUP command: $comma");
&busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null",
"for $status_statement now Modifying PS layout",
More information about the LON-CAPA-cvs
mailing list