[latex3-commits] [git/LaTeX3-latex3-hyperref] setpagesize: adapt pagesize to stockwidth (e5bd6bc)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Sep 20 21:33:00 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : setpagesize
Link       : https://github.com/latex3/hyperref/commit/e5bd6bcaa9131e879f53cc27e5b0d32134e6518e

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

commit e5bd6bcaa9131e879f53cc27e5b0d32134e6518e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Sep 20 21:33:00 2022 +0200

    adapt pagesize to stockwidth


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

e5bd6bcaa9131e879f53cc27e5b0d32134e6518e
 hyperref.dtx | 118 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 87 insertions(+), 31 deletions(-)

diff --git a/hyperref.dtx b/hyperref.dtx
index 6baf1e5..9cf3265 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -6696,7 +6696,7 @@
 \def\HyperDestNameFilter#1{#1}
 \Hy at AtBeginDocument{%
   \begingroup
-    \edef\x{\@ifundefined{stockheight}\paperheight\stockheight}%
+    \edef\x{\@ifundefined{stockheight}{\paperheight}{\ifdim\stockheight>\z@ \stockheight\else\paperheight\fi}}%
     \dimen@=\x\relax
     \ifdim\dimen@>\z@
     \else
@@ -13538,10 +13538,26 @@
         \fi
       }{%
         \ifdim\stockwidth>\z@
-          \setlength{\pdfpagewidth}{\stockwidth}%
-        \fi
-        \ifdim\stockheight>\z@
-          \setlength{\pdfpageheight}{\stockheight}%
+          \ifdim\stockheight>\z@
+           \setlength{\pdfpagewidth}{\stockwidth}%
+           \setlength{\pdfpageheight}{\stockheight}%
+          \else
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \setlength{\pdfpagewidth}{\paperwidth}%
+                \setlength{\pdfpageheight}{\paperheight}%
+              \fi
+            \fi
+          \fi
+        \else
+          \ifdim\stockwidth=\z@
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \setlength{\pdfpagewidth}{\paperwidth}%
+                \setlength{\pdfpageheight}{\paperheight}%
+              \fi
+            \fi
+          \fi
         \fi
       }%
     }%
@@ -14604,7 +14620,21 @@
       }{%
         \ifdim\stockwidth>\z@
           \ifdim\stockheight>\z@
-            \special{papersize=\the\stockwidth,\the\stockheight}%
+           \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
       }%
@@ -14743,32 +14773,44 @@
 %    it avoids the definition and the hash table entry of a
 %    previous undefined macro.
 %    \begin{macrocode}
-\ifx\mediaheight\@undefined
-\else
-  \ifx\mediaheight\relax
-  \else
-    \ifHy at setpagesize
-       \providecommand*{\VTeXInitMediaSize}{%
-         \ltx at IfUndefined{stockwidth}{%
-           \ifdim\paperheight>0pt %
-             \setlength\mediaheight\paperheight
-           \fi
-           \ifdim\paperheight>0pt %
-             \setlength\mediawidth\paperwidth
-           \fi
-         }{%
-           \ifdim\stockheight>0pt %
-             \setlength\mediaheight\stockheight
-           \fi
-           \ifdim\stockwidth>0pt %
-             \setlength\mediawidth\stockwidth
-           \fi
-         }%
+\ifcsname mediaheight\endcsname
+  \ifHy at setpagesize
+     \providecommand*{\VTeXInitMediaSize}{%
+       \ltx at IfUndefined{stockwidth}{%
+         \ifdim\paperheight>0pt %
+           \setlength\mediaheight\paperheight
+         \fi
+         \ifdim\paperheight>0pt %
+           \setlength\mediawidth\paperwidth
+         \fi
+       }{%
+        \ifdim\stockwidth>\z@
+          \ifdim\stockheight>\z@
+           \setlength\mediaheight\stockheight
+           \setlength\mediawidth\stockwidth
+          \else
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \setlength\mediaheight\paperheight
+                \setlength\mediawidth\paperwidth
+              \fi
+            \fi
+          \fi
+        \else
+          \ifdim\stockwidth=\z@
+            \ifdim\paperwidth>\z@
+              \ifdim\paperheight>\z@
+                \setlength\mediaheight\paperheight
+                \setlength\mediawidth\paperwidth
+              \fi
+            \fi
+          \fi
+        \fi
        }%
-       \Hy at AtBeginDocument{\VTeXInitMediaSize}%
-    \fi
-    \Hy at DisableOption{setpagesize}%
+     }%
+     \Hy at AtBeginDocument{\VTeXInitMediaSize}%
   \fi
+  \Hy at DisableOption{setpagesize}%
 \fi
 %    \end{macrocode}
 %    Older versions of VTeX require |xyz| in lower case.
@@ -16404,7 +16446,21 @@
       }{%
         \ifdim\stockwidth>\z@
           \ifdim\stockheight>\z@
-            \special{papersize=\the\stockwidth,\the\stockheight}%
+           \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
       }%





More information about the latex3-commits mailing list.