summaryrefslogtreecommitdiff
path: root/info/digests/texhax/txh/wolczko.txh
blob: 8a0ee65c0d1adfcd0b0561301ad291c70c2de102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
%  WOLCZKO.TXH; reference in TeXhax.8728

Date:     Wed, 15 Apr 87 13:00:36 BST
From:  Mario Wolczko <miw%unix.computer-science.manchester.ac.uk@Cs.Ucl.AC.UK>
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<nif; i++ )      /* copy all included files */
          CopyFile( Ifile[i] );
  
!     EMIT(outfp, "TeXDict begin @start\n");
      EMIT(outfp, "%%%%Title: %s\n", filename);
      EMIT(outfp, "%%%%Creator: %s\n", G_progname);
      EMIT(outfp, "%%%%EndProlog\n");
--- 454,462 ----
      for( i=0; i<nif; i++ )      /* copy all included files */
          CopyFile( Ifile[i] );
  
!     EMIT(outfp, "TeXDict begin \n");
!     EMIT(outfp, "%d @TexPagesPerPage\n", pages_per_page);
!     EMIT(outfp, "@start\n");
      EMIT(outfp, "%%%%Title: %s\n", filename);
      EMIT(outfp, "%%%%Creator: %s\n", G_progname);
      EMIT(outfp, "%%%%EndProlog\n");
***************
*** 927,932 ****
--- 930,942 ----
                          Fatal("Argument is not a valid integer\n", 0);
                      break;    
  
+ 	    	case 'x':       /* next arg is number of TeX pages per LaserWriter page */
+                     if( ++argind >= 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

----------------------------------------------------------------
-------