From 989493fc0cf04ec736a261d39eee40e1d7bdf4be Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 23 May 2022 03:03:21 +0000
Subject: CTAN sync 202205230303

---
 macros/latex/contrib/pdfpages/pdfpages.dtx | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

(limited to 'macros/latex/contrib/pdfpages/pdfpages.dtx')

diff --git a/macros/latex/contrib/pdfpages/pdfpages.dtx b/macros/latex/contrib/pdfpages/pdfpages.dtx
index 2deaa46206..1342d7ba42 100644
--- a/macros/latex/contrib/pdfpages/pdfpages.dtx
+++ b/macros/latex/contrib/pdfpages/pdfpages.dtx
@@ -27,12 +27,12 @@
 %<*dtx>
 \makeatletter
 %</dtx>
-\def\AM@fileversion{v0.5u}
+\def\AM@fileversion{v0.5v}
 \def\AM@Git@Date@process$#1: #2 #3${\AM@Git@Date@process@i#2\END}
 \def\AM@Git@Date@process@i#1-#2-#3\END{\def\AM@Git@Date{#1/#2/#3}}
 \def\AM@Git@SHA@process$#1: #2${\def\AM@Git@SHA{#2}}
-\AM@Git@Date@process$Date: 2022-01-29 16:59:20 +0100 $
-\AM@Git@SHA@process$SHA-1: 7a5d1a24653fdc93c11ca1043f6d77a403446d92 $
+\AM@Git@Date@process$Date: 2022-05-22 20:11:16 +0200 $
+\AM@Git@SHA@process$SHA-1: 059ee4174cc52b0e6a4c834c1a9719bcf5a453b0 $
 %</!(example1,example2,example3,installer)>
 %
 %
@@ -1339,6 +1339,7 @@
 \newcommand*{\AM@findfile@ii}[1]{%
   \ifx\AM@currentdocname\relax
     \PackageError{pdfpages}{Cannot find file `#1'}{}%
+    \let\AM@filenotfound\relax
   \fi
 }
 %    \end{macrocode}
@@ -1393,7 +1394,7 @@
     \def\AM@pagecount{0}%
   }{%
     \AM@findfile{#2}%
-    \if\AM@threadname\relax
+    \ifx\AM@threadname\relax
       \def\AM@threadname{\AM@currentdocname}%
     \fi
   }%
@@ -1481,8 +1482,17 @@
 %    \macro{\AM@output}
 %    This is the main output routine used by |\includepdf|
 %    and |\includepdfmerge|.
+%    Let's stop here if the PDF file doesn't exist and the user did not quit
+%    \LaTeX\ yet (which may result from `--interaction=scrollmode`).
+%    If we do not quit here, we might run into an infinite loop.
 %    \begin{macrocode}
-\newcommand{\AM@output}[1]{%
+\newcommand\AM@output{%
+  \ifdefined\AM@filenotfound
+  \else
+    \expandafter\AM@output@i
+  \fi
+}
+\newcommand{\AM@output@i}[1]{%
 %    \end{macrocode}
 %    For the following calculations we need to know the page size.
 %    But since we are still before |\newpage| we must not set |\paper{width,height}|
@@ -4851,6 +4861,12 @@
 %    \item Adding |\leavevmode| before |\@chapter|,... in |addtotoc|.
 %    Bug fix for \url{https://tex.stackexchange.com/questions/631514/}.
 %    \end{itemize}
+%
+%    \subsection*{2022/05/21 v0.5v}
+%    \begin{itemize}
+%    \item Do not enter an infinite loop if the PDF file doesn't exist.
+%    Bug fix for \url{https://tex.stackexchange.com/questions/644971/}.
+%    \end{itemize}
 %    \Finale
 %
 %    \iffalse
-- 
cgit v1.2.3

