summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pdfpages/pdfpages.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/pdfpages/pdfpages.dtx')
-rw-r--r--macros/latex/contrib/pdfpages/pdfpages.dtx43
1 files changed, 36 insertions, 7 deletions
diff --git a/macros/latex/contrib/pdfpages/pdfpages.dtx b/macros/latex/contrib/pdfpages/pdfpages.dtx
index 3cd8f9cb0f..587b47cb53 100644
--- a/macros/latex/contrib/pdfpages/pdfpages.dtx
+++ b/macros/latex/contrib/pdfpages/pdfpages.dtx
@@ -2,7 +2,7 @@
% \iffalse
%
%<*(package,pppdftexdef,ppluatexdef,ppvtexdef,ppxetexdef,ppdvipsdef,ppdvipdfmxdef,ppnulldef)>
-%% Copyright (C) 2001-2020 Andreas MATTHIAS
+%% Copyright (C) 2001-2021 Andreas MATTHIAS
%%
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
@@ -27,12 +27,12 @@
%<*dtx>
\makeatletter
%</dtx>
-\def\AM@fileversion{v0.5q}
+\def\AM@fileversion{v0.5r}
\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: 2020-01-28 18:31:23 +0100 $
-\AM@Git@SHA@process$SHA-1: 105b2fdadf38120b838b3393c5cf83a7db30724e $
+\AM@Git@Date@process$Date: 2021-01-09 21:30:43 +0100 $
+\AM@Git@SHA@process$SHA-1: 835dfb0d7e5502acd5c811aa9c00b2e44eae9cbd $
%</!(example1,example2,example3,installer)>
%
%
@@ -84,7 +84,7 @@
%
% \GetFileInfo{pdfpages.dtx}
%
-% \CheckSum{5022}
+% \CheckSum{5059}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -108,6 +108,7 @@
\documentclass{ltxdoc}
\usepackage{array}
\usepackage{graphicx}
+\usepackage{booktabs}
\usepackage{cmap}
\usepackage{hypdoc}
\hypersetup{colorlinks, linkcolor=blue, pdfstartview={Fit},
@@ -515,8 +516,8 @@
% \item[linktodoc] Lets the inserted pages be hyperlinks to the
% document from which they were extracted.
% Note that the \PDF-Viewer will not find the
-% file, if \meta{filename} has not filename
-% extension (.pdf).
+% file, if filename extension (.pdf) is missing
+% in \meta{filename}.
% Either `true' or `false' (or no value, which
% is equivalent to `true'). \df{linktodoc=false}
% \end{description}
@@ -1238,6 +1239,28 @@
\newif\ifAM@memoir\AM@memoirfalse
\@ifclassloaded{memoir}{\AM@memoirtrue}{}
% \end{macrocode}
+% Pdfpages calls |\includegraphics| several times to retrieve necessary
+% information like width, height, or number of pages without actually
+% typesetting the image. Just the final call to |\includegraphics| will
+% eventually typeset the image. Packages which hook into
+% |\includegraphics| and whish to check whether or not this is the final
+% call to |\includegraphics| can do so by using the counter
+% |\pdfpages@includegraphics@status|:
+% \begin{quotation}
+% \begin{tabular}{@{}cl@{}}
+% \toprule
+% Status & Use of |\includegraphics| ...\\
+% \midrule
+% 0 & outside of pdfpages\\
+% 1 & inside of pdfpages: final call\\
+% 2 & inside of pdfpages: non-final call, for internal use\\
+% \bottomrule
+% \end{tabular}
+% \end{quotation}
+% \begin{macrocode}
+\newcount\pdfpages@includegraphics@status
+\pdfpages@includegraphics@status\z@
+% \end{macrocode}
% \subsection{Commands}
% Declare macro names and define default values.
% \begin{macrocode}
@@ -1352,6 +1375,7 @@
% \begin{macrocode}
\newcommand*{\includepdf}[2][]{%
\begingroup
+ \global\pdfpages@includegraphics@status\tw@
\AM@pagecnt\@ne
\let\AM@threadname\relax
\def\AM@tmp{pdfpages}
@@ -1410,6 +1434,7 @@
\AM@CheckAtEnd
\endgroup
\AM@ClearShipoutPicture
+ \global\pdfpages@includegraphics@status\z@
}
% \end{macrocode}
% \macro{\includepdfmerge}
@@ -1417,6 +1442,7 @@
% \begin{macrocode}
\newcommand*{\includepdfmerge}[2][]{%
\begingroup
+ \global\pdfpages@includegraphics@status\tw@
\AM@pagecnt\@ne
\let\AM@currentdocname\relax
\def\AM@tmp{pdfpages}
@@ -1430,6 +1456,7 @@
\AM@CheckAtEnd
\endgroup
\AM@ClearShipoutPicture
+ \global\pdfpages@includegraphics@status\z@
}
% \end{macrocode}
% \macro{\AM@CheckAtEnd}
@@ -1936,11 +1963,13 @@
\noexpand\raise \ht\@tempboxa \hbox{\AM@hyper@begin@i}%
% \end{macrocode}
% \begin{macrocode}
+ \global\pdfpages@includegraphics@status\@ne
\AM@hyper@begin@ii\noexpand\AM@fbox{%
\noexpand\AM@ARBug@hook
\noexpand\AM@reflectbox{%
\expandafter\noexpand\expandafter
\includegraphics\AM@opts{\AM@docname}}}%
+ \global\pdfpages@includegraphics@status\tw@
\AM@hyper@end}}%
}%
\fi