[latex3-commits] [git/LaTeX3-latex3-hyperref] setpagesize: provide stockheight/stockwidth to simplify test (2c91cd4)
Ulrike Fischer
fischer at troubleshooting-tex.de
Wed Sep 21 20:13:38 CEST 2022
Repository : https://github.com/latex3/hyperref
On branch : setpagesize
Link : https://github.com/latex3/hyperref/commit/2c91cd4e213f855774737596fcb6fe1261480257
>---------------------------------------------------------------
commit 2c91cd4e213f855774737596fcb6fe1261480257
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Wed Sep 21 20:13:38 2022 +0200
provide stockheight/stockwidth to simplify test
>---------------------------------------------------------------
2c91cd4e213f855774737596fcb6fe1261480257
hyperref.dtx | 131 +++++++++++++++++++++++------------------------------------
1 file changed, 51 insertions(+), 80 deletions(-)
diff --git a/hyperref.dtx b/hyperref.dtx
index 9cf3265..0ed9f7d 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -6696,7 +6696,7 @@
\def\HyperDestNameFilter#1{#1}
\Hy at AtBeginDocument{%
\begingroup
- \edef\x{\@ifundefined{stockheight}{\paperheight}{\ifdim\stockheight>\z@ \stockheight\else\paperheight\fi}}%
+ \edef\x{\ifdim\stockheight>\z@ \stockheight\else\paperheight\fi}%
\dimen@=\x\relax
\ifdim\dimen@>\z@
\else
@@ -6985,6 +6985,11 @@
% \end{macrocode}
%
% \subsubsection{Driver loading}
+% Ensure that |\stockwidth| and |\stockheight| are defined
+% \begin{macrocode}
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
+% \end{macrocode}
%
% \begin{macrocode}
\Hy at AtEndOfPackage{%
@@ -13529,37 +13534,28 @@
\fi
\fi
}{%
- \ltx at IfUndefined{stockwidth}{%
- \ifdim\paperwidth>\z@
- \setlength{\pdfpagewidth}{\paperwidth}%
- \fi
- \ifdim\paperheight>\z@
- \setlength{\pdfpageheight}{\paperheight}%
- \fi
- }{%
- \ifdim\stockwidth>\z@
- \ifdim\stockheight>\z@
- \setlength{\pdfpagewidth}{\stockwidth}%
- \setlength{\pdfpageheight}{\stockheight}%
- \else
- \ifdim\paperwidth>\z@
- \ifdim\paperheight>\z@
- \setlength{\pdfpagewidth}{\paperwidth}%
- \setlength{\pdfpageheight}{\paperheight}%
- \fi
+ \ifdim\stockwidth>\z@
+ \ifdim\stockheight>\z@
+ \setlength{\pdfpagewidth}{\stockwidth}%
+ \setlength{\pdfpageheight}{\stockheight}%
+ \else
+ \ifdim\paperwidth>\z@
+ \ifdim\paperheight>\z@
+ \setlength{\pdfpagewidth}{\paperwidth}%
+ \setlength{\pdfpageheight}{\paperheight}%
\fi
\fi
- \else
- \ifdim\stockwidth=\z@
- \ifdim\paperwidth>\z@
- \ifdim\paperheight>\z@
- \setlength{\pdfpagewidth}{\paperwidth}%
- \setlength{\pdfpageheight}{\paperheight}%
- \fi
+ \fi
+ \else
+ \ifdim\stockwidth=\z@
+ \ifdim\paperwidth>\z@
+ \ifdim\paperheight>\z@
+ \setlength{\pdfpagewidth}{\paperwidth}%
+ \setlength{\pdfpageheight}{\paperheight}%
\fi
\fi
\fi
- }%
+ \fi
}%
}%
\Hy at DisableOption{setpagesize}%
@@ -14611,33 +14607,25 @@
\AtBeginShipoutFirst{%
\ifHy at setpagesize
\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
\Hy at DisableOption{setpagesize}%
@@ -14776,14 +14764,6 @@
\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
@@ -14806,7 +14786,6 @@
\fi
\fi
\fi
- }%
}%
\Hy at AtBeginDocument{\VTeXInitMediaSize}%
\fi
@@ -16437,33 +16416,25 @@
\AtBeginShipoutFirst{%
\ifHy at setpagesize
\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
\Hy at DisableOption{setpagesize}%
More information about the latex3-commits
mailing list.