[latex3-commits] [git/LaTeX3-latex3-graphics-def] fix-stockwidth: adapt mediabox code to stockwidth (e367042)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Sep 20 23:53:07 CEST 2022


Repository : https://github.com/latex3/graphics-def
On branch  : fix-stockwidth
Link       : https://github.com/latex3/graphics-def/commit/e367042249dcb668e37232c8ebd508c8d3a6f7e3

>---------------------------------------------------------------

commit e367042249dcb668e37232c8ebd508c8d3a6f7e3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Sep 20 23:53:07 2022 +0200

    adapt mediabox code to stockwidth


>---------------------------------------------------------------

e367042249dcb668e37232c8ebd508c8d3a6f7e3
 dvipdfmx.def | 37 +++++++++++++++++++++++++++----------
 dvips.def    | 39 ++++++++++++++++++++++++++++-----------
 luatex.def   | 22 +++++++++++++++++++---
 pdftex.def   | 28 ++++++++++++++++++++++------
 xetex.def    | 28 ++++++++++++++++++++++------
 5 files changed, 118 insertions(+), 36 deletions(-)

diff --git a/dvipdfmx.def b/dvipdfmx.def
index 1d82661..46546cc 100644
--- a/dvipdfmx.def
+++ b/dvipdfmx.def
@@ -314,16 +314,33 @@
 \ifnum\mag=\@m
 \AtBeginDvi{%
 \begingroup
-  \@ifundefined{stockwidth}{}
-    {%
-      \paperwidth\stockwidth
-      \paperheight\stockheight
-    }%
-\ifdim\paperwidth>\z@
-\ifdim\paperheight>\z@
-\special{pdf:pagesize width \the\paperwidth\GPT at space height \the\paperheight}%
-\fi
-\fi
+  \@ifundefined{stockwidth}{%
+    \ifdim\paperwidth>\z@
+      \ifdim\paperheight>\z@
+        \special{papersize=\the\paperwidth,\the\paperheight}%
+      \fi
+    \fi
+  }{%
+    \ifdim\stockwidth>\z@
+      \ifdim\stockheight>\z@
+        \special{papersize=\the\stockwidth,\the\stockheight}%
+      \else
+        \ifdim\paperwidth>\z@
+          \ifdim\paperheight>\z@
+            \special{papersize=\the\paperwidth,\the\paperheight}%
+          \fi
+        \fi
+      \fi
+    \else
+      \ifdim\stockwidth=\z@
+        \ifdim\paperwidth>\z@
+          \ifdim\paperheight>\z@
+            \special{papersize=\the\paperwidth,\the\paperheight}%
+          \fi
+        \fi
+      \fi
+    \fi
+      }%
 \endgroup}%
 \fi
 }
diff --git a/dvips.def b/dvips.def
index 204ec64..f099b4f 100644
--- a/dvips.def
+++ b/dvips.def
@@ -151,19 +151,36 @@
   \AtBeginDocument{%
 % If a package has changed \mag, assume it knows what it is doing
 % and leave page size alone
-\ifnum\mag=\@m
+ \ifnum\mag=\@m
   \AtBeginDvi{%
     \begingroup
-      \@ifundefined{stockwidth}{}
-        {%
-          \paperwidth\stockwidth
-          \paperheight\stockheight
-        }%
-    \ifdim\paperwidth>\z@
-      \ifdim\paperheight>\z@
-        \special{papersize=\the\paperwidth,\the\paperheight}%
-      \fi
-    \fi
+      \@ifundefined{stockwidth}{%
+        \ifdim\paperwidth>\z@
+          \ifdim\paperheight>\z@
+            \special{papersize=\the\paperwidth,\the\paperheight}%
+          \fi
+        \fi
+      }{%
+        \ifdim\stockwidth>\z@
+          \ifdim\stockheight>\z@
+           \special{papersize=\the\stockwidth,\the\stockheight}%
+          \else
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \special{papersize=\the\paperwidth,\the\paperheight}%
+              \fi
+            \fi
+          \fi
+        \else
+          \ifdim\stockwidth=\z@
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \special{papersize=\the\paperwidth,\the\paperheight}%
+              \fi
+            \fi
+          \fi
+        \fi
+      }%
     \endgroup}%
     \fi
     }
diff --git a/luatex.def b/luatex.def
index 102e897..9fa6efd 100644
--- a/luatex.def
+++ b/luatex.def
@@ -563,10 +563,26 @@
 }{%
   \ifdim\stockwidth>0pt\relax
     \ifdim\stockheight>0pt\relax
-      \pagewidth=\stockwidth
-      \pageheight=\stockheight
+       \setlength{\pagewidth}{\stockwidth}%
+       \setlength{\pageheight}{\stockheight}%
+    \else
+      \ifdim\paperwidth>0pt\relax
+        \ifdim\paperheight>0pt\relax
+          \setlength{\pagewidth}{\paperwidth}%
+          \setlength{\pageheight}{\paperheight}%
+        \fi
+      \fi
     \fi
-  \fi
+   \else
+    \ifdim\stockwidth=0pt\relax
+      \ifdim\paperwidth>0pt\relax
+        \ifdim\paperheight>0pt\relax
+          \setlength{\pagewidth}{\paperwidth}%
+          \setlength{\pageheight}{\paperheight}%
+        \fi
+      \fi
+    \fi
+   \fi
 }%
 \fi
 }
diff --git a/pdftex.def b/pdftex.def
index e9fd018..f0ba0d3 100644
--- a/pdftex.def
+++ b/pdftex.def
@@ -572,12 +572,28 @@ E     \else
     \fi
   }%
 }{%
-  \ifdim\stockwidth>0pt\relax
-    \ifdim\stockheight>0pt\relax
-      \pdfpagewidth=\stockwidth
-      \pdfpageheight=\stockheight
-    \fi
-  \fi
+   \ifdim\stockwidth>0pt\relax
+     \ifdim\stockheight>0pt\relax
+       \setlength{\pdfpagewidth}{\stockwidth}%
+       \setlength{\pdfpageheight}{\stockheight}%
+     \else
+       \ifdim\paperwidth>0pt\relax
+         \ifdim\paperheight>0pt\relax
+            \setlength{\pdfpagewidth}{\paperwidth}%
+            \setlength{\pdfpageheight}{\paperheight}%
+         \fi
+       \fi
+     \fi
+   \else
+     \ifdim\stockwidth=0pt\relax
+       \ifdim\paperwidth>0pt\relax
+         \ifdim\paperheight>0pt\relax
+           \setlength{\pdfpagewidth}{\paperwidth}%
+           \setlength{\pdfpageheight}{\paperheight}%
+         \fi
+       \fi
+     \fi
+   \fi
 }%
 \fi
 }
diff --git a/xetex.def b/xetex.def
index 7293379..4f074db 100644
--- a/xetex.def
+++ b/xetex.def
@@ -417,12 +417,28 @@
 \fi
 }%
 }{%
-\ifdim\stockwidth>0pt\relax
-\ifdim\stockheight>0pt\relax
-\pdfpagewidth=\stockwidth
-\pdfpageheight=\stockheight
-\fi
-\fi
+   \ifdim\stockwidth>0pt\relax
+     \ifdim\stockheight>0pt\relax
+       \setlength{\pdfpagewidth}{\stockwidth}%
+       \setlength{\pdfpageheight}{\stockheight}%
+     \else
+       \ifdim\paperwidth>0pt\relax
+         \ifdim\paperheight>0pt\relax
+            \setlength{\pdfpagewidth}{\paperwidth}%
+            \setlength{\pdfpageheight}{\paperheight}%
+         \fi
+       \fi
+     \fi
+   \else
+     \ifdim\stockwidth=0pt\relax
+       \ifdim\paperwidth>0pt\relax
+         \ifdim\paperheight>0pt\relax
+           \setlength{\pdfpagewidth}{\paperwidth}%
+           \setlength{\pdfpageheight}{\paperheight}%
+         \fi
+       \fi
+     \fi
+   \fi
 }%
 \fi
 }





More information about the latex3-commits mailing list.