[latex3-commits] [git/LaTeX3-latex3-graphics-def] fix-stockwidth: simplify mediabox setting by predefining stockwidth (ab82502)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Sep 21 20:03:02 CEST 2022


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

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

commit ab82502ddce703dc6aee5b8e0856a7192ac0a7c1
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Sep 21 20:03:02 2022 +0200

    simplify mediabox setting by predefining stockwidth


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

ab82502ddce703dc6aee5b8e0856a7192ac0a7c1
 dvipdfmx.def | 38 ++++++++++++++++----------------------
 dvips.def    | 38 ++++++++++++++++----------------------
 pdftex.def   | 54 ++++++++++++++++++++++--------------------------------
 xetex.def    | 54 ++++++++++++++++++++++--------------------------------
 4 files changed, 76 insertions(+), 108 deletions(-)

diff --git a/dvipdfmx.def b/dvipdfmx.def
index 46546cc..96d76b2 100644
--- a/dvipdfmx.def
+++ b/dvipdfmx.def
@@ -306,6 +306,8 @@
 {\expandafter\let\csname ifGin at setpagesize\expandafter\endcsname
 \csname iftrue\endcsname}
 {}
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
 \ifGin at setpagesize
 \ifx\paperwidth\@undefined\else
 \AtBeginDocument{%
@@ -314,33 +316,25 @@
 \ifnum\mag=\@m
 \AtBeginDvi{%
 \begingroup
-  \@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
+  \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
-    \else
-      \ifdim\stockwidth=\z@
-        \ifdim\paperwidth>\z@
-          \ifdim\paperheight>\z@
-            \special{papersize=\the\paperwidth,\the\paperheight}%
-          \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 f099b4f..b85033b 100644
--- a/dvips.def
+++ b/dvips.def
@@ -146,6 +146,8 @@
   {\expandafter\let\csname ifGin at setpagesize\expandafter\endcsname
                     \csname iftrue\endcsname}
   {}
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
 \ifGin at setpagesize
 \ifx\paperwidth\@undefined\else
   \AtBeginDocument{%
@@ -154,33 +156,25 @@
  \ifnum\mag=\@m
   \AtBeginDvi{%
     \begingroup
-      \@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
+      \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
-        \else
-          \ifdim\stockwidth=\z@
-            \ifdim\paperwidth>\z@
-              \ifdim\paperheight>\z@
-                \special{papersize=\the\paperwidth,\the\paperheight}%
-              \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/pdftex.def b/pdftex.def
index f0ba0d3..e6a21d9 100644
--- a/pdftex.def
+++ b/pdftex.def
@@ -555,46 +555,36 @@ E     \else
   {\expandafter\let\csname ifGin at setpagesize\expandafter\endcsname
                     \csname iftrue\endcsname}
   {}
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
 \ifGin at setpagesize
 \ifx\paperwidth\@undefined\else
   \AtBeginDocument{%
 % If a package has changed \mag, assume it knows what it is doing
 % and leave page size alone
 \ifnum\mag=\@m
-  \@ifundefined{stockwidth}{%
-  \@ifundefined{paperwidth}{%
-  }{%
-    \ifdim\paperwidth>0pt\relax
-      \ifdim\paperheight>0pt\relax
-        \pdfpagewidth=\paperwidth
-        \pdfpageheight=\paperheight
+  \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
-  }%
-}{%
-   \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
-}%
+  \else
+    \ifdim\stockwidth=0pt\relax
+      \ifdim\paperwidth>0pt\relax
+        \ifdim\paperheight>0pt\relax
+          \setlength{\pdfpagewidth}{\paperwidth}%
+          \setlength{\pdfpageheight}{\paperheight}%
+        \fi
+      \fi
+    \fi
+  \fi
 \fi
 }
 \fi
diff --git a/xetex.def b/xetex.def
index 4f074db..83ee086 100644
--- a/xetex.def
+++ b/xetex.def
@@ -400,46 +400,36 @@
 {\expandafter\let\csname ifGin at setpagesize\expandafter\endcsname
 \csname iftrue\endcsname}
 {}
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
 \ifGin at setpagesize
 \ifx\paperwidth\@undefined\else
 \AtBeginDocument{%
 % If a package has changed \mag, assume it knows what it is doing
 % and leave page size alone
 \ifnum\mag=\@m
-\@ifundefined{stockwidth}{%
-\@ifundefined{paperwidth}{%
-}{%
-\ifdim\paperwidth>0pt\relax
-\ifdim\paperheight>0pt\relax
-\pdfpagewidth=\paperwidth
-\pdfpageheight=\paperheight
-\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
+  \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
-   \fi
-}%
+        \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
 }
 \fi





More information about the latex3-commits mailing list.