% WOLCZKO.TXH; reference in TeXhax.8728 Date: Wed, 15 Apr 87 13:00:36 BST From: Mario Wolczko Subject: Another feature for dvi2ps Following Jean-Francois Lamy's message clarifying which versions of dvi2ps can do what, here is yet another feature. Strictly speaking, I suppose it should be posted to the Unix-TeX mailing list, but that seems to have died a sudden death. It was written by Ifor Williams, a PhD student here. The differences listed below can be applied directly to the "2.10gf" version of dvi2ps (last modified by Rick Furuta, 8th Aug 1986). The modifications add a "-x n" option to dvi2ps, enabling the printing of n TeX pages on a PostScript page. This is great at saving paper; the use of -x 2 is recommended for all drafts, and even -x 4 works fine with 12pt text. Obviously, only powers of 2 are sensible values for n. Other things to note: 1. The sense of the -r switch is reversed in the presence of -x; pages now come out with pages 1..n at the bottom of the paper tray. 2. Specials don't seem to scale along with the rest of the text (this is a bug). 3. All dimensions relate to the A4 page size. This has the nice property that the length of the long edge is sqrt(2) times the length of the short edge. 4. Certain magic numbers appear within the PostScript prolog; these may have to be tweaked at your installation. Comments indicate where this should take place. Incidentally, does anyone know if it's possible to set a LaserWriter up to print on a full A4 page (including the bottom 1/2 inch)? I tried messing about with the definition of PostScript "letter" but got nowhere. Mario Wolczko ------------------------------------------------------------------------ Dept. of Computer Science ARPA: miw%uk.ac.man.cs.ux@cs.ucl.ac.uk The University USENET: mcvax!ukc!man.cs.ux!miw Manchester M13 9PL JANET: miw@uk.ac.man.cs.ux U.K. 061-273 7121 x 5699 ------------------------------------------------------------------------ *** dvi2ps-gf/dvi2ps.c Wed Oct 15 16:20:18 1986 --- dvi2ps-gf-n/dvi2ps.c Thu Feb 5 09:37:53 1987 *************** *** 350,355 **** --- 350,356 ---- int vv = 0; /* current v on device */ int mag; /* magnification specified in preamble */ int ncopies = 1; /* number of copies to print */ + int pages_per_page = 1; /* number of TeX pages per LaserWriter page*/ int ndone = 0; /* number of pages converted */ int nif = 0; /* number of files to include */ int nopen; /* number of open PXL files */ *************** *** 453,459 **** for( i=0; i= argc || sscanf(argv[argind], "%d", &pages_per_page) != 1 ) + Fatal("Argument is not a valid integer\n", 0); + if (pages_per_page != 1) + Reverse = !Reverse; /* forward makes more sense here */ + break; + case 'o': /* next arg is a PostScript command to send */ if( ++argind >= argc ) Fatal("No argument following -o\n", 0); *************** *** 943,949 **** break; case 'r': /* don't process pages in reverse order */ ! Reverse = FALSE; break; #ifdef STATS case 's': /* print some statistics */ --- 953,959 ---- break; case 'r': /* don't process pages in reverse order */ ! Reverse = !Reverse; break; #ifdef STATS case 's': /* print some statistics */ *** tex-gf.ps Mon Jan 19 18:09:04 1987 --- tex-gf-n.ps Sat Mar 14 14:50:25 1987 *************** *** 47,58 **** % [ 1 e ] % where the "e"s were almost exactly but not quite unlike zeros. /@letter ! { letter initmatrix ! 72 Resolution div dup neg scale % set scaling to 1. ! 310 -3005 translate % move origin to top (these are not exactly 1" ! Mtrx currentmatrix pop % and -10" because margins aren't set exactly right) } def % note mode is like letter, except it uses less VM /@note { note initmatrix --- 47,104 ---- % [ 1 e ] % where the "e"s were almost exactly but not quite unlike zeros. + + %%%%%%%%%#### Additional Procedure Definitions ####%%%%%%%%%%%%%%%%%%%%%%%%%% + + /numberOfRows % the number of page rows on LaserWriter page + {2 power 2 div truncate exp} def + + /numberOfColumns % the number of page columns on LaserWriter page + {2 power 2 div ceiling exp} def + + /setscale + {72 Resolution div dup xscale mul exch yscale mul neg scale} def + % Sets the scaling to the appropriate ammount. Note + % the negative y direction scaling factor to account for the + % discrepancy between TeX and PostScript co-ordinates + + /@TexPagesPerPage + { + /power exch log 2 log div ceiling def % numberofpages <= 2^power. + /odd power cvi 2 mod 1 eq def % boolean, "power is odd". + /rowCount numberOfRows def % initialise loop count variables. + /columnCount numberOfColumns def + /xscale 1 rowCount div def % 1/No. rows for x scaling + /yscale 1 columnCount div def % 1/No. columns for y scaling + } def + + + %%%%%%%%%%%####---------------------------------####%%%%%%%%%%%%%%%%%%%%%% + /@letter ! { ! odd ! { ! Mtrx currentmatrix 0 0.0 put ! Mtrx 1 -1.0 put ! Mtrx 2 1.0 put ! Mtrx 3 0.0 put ! Mtrx setmatrix ! 0.707101 1.41421 yscale mul exch xscale mul scale ! % dont ask!....It works. ! 300 390 translate % move origin to top ! Mtrx currentmatrix pop ! } ! { ! letter initmatrix ! setscale ! 390 -3000 numberOfRows mul translate ! % move origin to top (these are not exactly 1" ! % and -10" because margins aren't set exactly right) ! Mtrx currentmatrix pop ! } ifelse } def + % note mode is like letter, except it uses less VM /@note { note initmatrix *************** *** 162,176 **** /@bop1 % n @bop1 - -- begin a brand new page { pop ! erasepage initgraphics ! Mtrx setmatrix ! /SaveImage save def() pop } def /@eop % - @eop - -- end a page ! { showpage ! SaveImage restore() pop ! } def /@start % - @start - -- start everything { @letter % (there is not much to do) --- 208,242 ---- /@bop1 % n @bop1 - -- begin a brand new page { pop ! % erasepage initgraphics ! % Mtrx setmatrix ! % /SaveImage save def() pop } def /@eop % - @eop - -- end a page ! { ! columnCount 1 ne ! { ! 2250 0 translate % move right one TeX page ! /columnCount columnCount 1 sub def % and note new column ! } ! { ! rowCount 1 ne ! { ! /columnCount numberOfColumns def % reset the column count ! /rowCount rowCount 1 sub def % note entry into a new row ! -2250 columnCount 1 sub mul 3005 translate ! % move far left and down one TeX page ! } ! { ! showpage ! /columnCount numberOfColumns def % reset the column count ! /rowCount numberOfRows def % reset the row count ! erasepage initgraphics ! Mtrx setmatrix ! } ifelse ! } ifelse ! } def /@start % - @start - -- start everything { @letter % (there is not much to do) *************** *** 177,183 **** } def /@end % - @end - -- done the whole shebang ! { end } def /p % x y p - -- move to position --- 243,255 ---- } def /@end % - @end - -- done the whole shebang ! { ! columnCount numberOfColumns eq ! rowCount numberOfRows eq ! and not ! {showpage} ! if ! end } def /p % x y p - -- move to position ---------------------------------------------------------------- -------