Package: texlive-bin / 2016.20160513.41080.dfsg-2+deb9u1

upstream-svn41762-ptex-savepos-improved Patch series | download
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
diff --git a/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog
index 20c37df..d7807ae 100644
--- a/texk/web2c/eptexdir/ChangeLog
+++ b/texk/web2c/eptexdir/ChangeLog
@@ -1,3 +1,7 @@
+2016-07-29  Hironori Kitagawa  <h_kitagawa2001@yahoo.co.jp>
+
+	* pdfutils.ch: Improve \pdfsavepos as pointed out by N. Abe.
+
 2016-03-04  Hironori Kitagawa  <h_kitagawa2001@yahoo.co.jp>
 
 	* etex.ch1: Adapt to changes in ptexdir/ptex-base.ch.
diff --git a/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch
index b5380c8..d800531 100644
--- a/texk/web2c/eptexdir/pdfutils.ch
+++ b/texk/web2c/eptexdir/pdfutils.ch
@@ -945,7 +945,7 @@ begin
   pdf_last_x_pos := pdf_last_x_pos + 4736286;
   case dvi_dir of
   dir_tate,dir_dtou:
-    pdf_last_y_pos := cur_page_width - pdf_last_y_pos - 4736286;
+    pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286;
   dir_yoko:
     pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286;
   endcases;
@@ -955,16 +955,24 @@ end
 @ @<Calculate DVI page dimensions and margins@>=
   if pdf_page_height <> 0 then
     cur_page_height := pdf_page_height
+  else if (type(p)=dir_node) then begin
+    if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then
+        cur_page_height := width(p) + 2*v_offset + 2*4736286
+    else
+      cur_page_height := height(p) + depth(p) + 2*v_offset + 2*4736286;
+    end
   else
     cur_page_height := height(p) + depth(p) + 2*v_offset + 2*4736286;
   if pdf_page_width <> 0 then
     cur_page_width := pdf_page_width
+  else if (type(p)=dir_node) then begin
+    if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then
+      cur_page_width := height(p) + depth(p) + 2*h_offset + 2*4736286
+    else
+      cur_page_width := width(p) + 2*h_offset + 2*4736286;
+    end
   else
     cur_page_width := width(p) + 2*h_offset + 2*4736286;
-  if (type(p)=dir_node) then
-    if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then begin
-      t:=cur_page_height; cur_page_height:=cur_page_width;
-      cur_page_width:=t; end;
 
 
 @ Of course \epTeX\ can produce a \.{DVI} file only, not a PDF file.