From f61c28434c5b598450e4826a6494827f39312f34 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 13 Aug 2015 20:55:22 +0000 Subject: pdfpages (13aug15) git-svn-id: svn://tug.org/texlive/trunk@38116 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/pdfpages/pdfpages.dtx | 157 ++++++++++++++++++--- 1 file changed, 138 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/pdfpages/pdfpages.dtx b/Master/texmf-dist/source/latex/pdfpages/pdfpages.dtx index 4bf3cd54281..adac8ba5fb7 100644 --- a/Master/texmf-dist/source/latex/pdfpages/pdfpages.dtx +++ b/Master/texmf-dist/source/latex/pdfpages/pdfpages.dtx @@ -27,12 +27,12 @@ %<*dtx> \makeatletter % -\def\AM@fileversion{v0.5a} +\def\AM@fileversion{v0.5b} \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: 2015-07-19 17:18:25 +0200 $ -\AM@Git@SHA@process$SHA-1: e79a333f7b4030269da1c5f48fa2c8d07b41b058 $ +\AM@Git@Date@process$Date: 2015-08-13 17:38:37 +0200 $ +\AM@Git@SHA@process$SHA-1: 54e50f1cc837f422c29e405d8b7d7849b0530ceb $ % % % @@ -84,7 +84,7 @@ % % \GetFileInfo{pdfpages.dtx} % -% \CheckSum{4707} +% \CheckSum{4786} % % \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 @@ -133,6 +133,7 @@ % \def\XeTeX{XeTeX} % \def\dvips{dvips} % \def\dvipdfmx{dvipdfmx} +% \def\pTeX{pTeX} % \def\PDF{{\small PDF}} % \def\PS{{\small PS}} % \def\DVI{{\small DVI}} @@ -157,7 +158,8 @@ % \begin{abstract} % \noindent % This package simplifies the insertion of external multi-page \PDF\ -% or \PS\ documents. It supports \pdfTeX, \VTeX, \XeTeX, and \luaTeX +% or \PS\ documents. It supports \pdfTeX, \VTeX, \XeTeX, \luaTeX, and +% \pTeX. % \end{abstract} % % \tableofcontents @@ -200,6 +202,21 @@ % reinserted by a package called \emph{pax} which can be downloaded from % CTAN \cite{pax}. Have a look at it! % +% \paragraph{Help} +% I really enjoy working on the pdfpages package in my spare time and I +% appreciate your great feedback. You, the users, encouraged me to start +% with pdfpages and to continue working on it for more than 14 years +% now. It's great to be part of this magnificent TeX community. I enjoyed +% every minute and the pdfpages project itself does not need any +% donations. +% +% However, I'd be very grateful if you made a donation to Kira Gr\"unberg +% at \url{http://www.donationkira.com/}. Kira is an Austrian pole vaulter +% who had a terrible training accident in July 2015. Since then she is +% paralysed from the neck down. Diagnosed to be a permanent damage of the +% spinal cord. I'd be very pleased to hear from you making a donation to +% Kira. Thank you! +% % % \section{Usage} % \subsection{Package Options} @@ -224,8 +241,8 @@ % \end{minipage} % \end{quote} % \end{minipage} -% -% +% +% % \subsection{Commands} % % \DescribeMacro{\includepdf} @@ -971,6 +988,26 @@ % Regardless of any other options. % % +% \subsection{Hints for Users of platex} +% \begin{itemize} +% \item +% The recommended way to tell |pdfpages| that you are using |platex| is to +% add |dvipdfmx| as a class option, e.g.: +% +% \begin{quote} +% |\documentclass[dvipdfmx]{article}|\\ +% |\usepackage{pdfpages}| +% \end{quote} +% +% \item Pdfpages calls program |extractbb| to get the total number of +% pages of a PDF. But if an |xbb| file (output of |extractbb|) exists, +% pdfpages will not call |extractbb| but use this file. However, be +% very cautious with |xbb| files: \emph{Do not use |xbb| files for PDFs +% with varying page sizes.} Because an |xbb| file contains only the page +% size of a single page. +% \end{itemize} +% +% % \subsection{Pitfalls} % % \begin{description} @@ -990,7 +1027,6 @@ % \end{description} % % -% % \section{Required Packages} % % The |pdfpages| package requires the following packages: @@ -2062,7 +2098,7 @@ \ifthenelse{\boolean{AM@pkg@draft} \and \boolean{AM@survey}}{% }{% \PackageError{pdfpages} - {page #1 of `\AM@currentdocname' does not exist} + {Page #1 of `\AM@currentdocname' does not exist} {You have set a wrong page number in the `pages' option. Document \MessageBreak `\AM@currentdocname' does not have #1 pages.}% @@ -3879,10 +3915,40 @@ % % \subsubsection{Dvipdfmx driver} % +% Driver |dvipdfmx| must be invoked explicitely by the user. There are +% several ways to do this. Though only the first of the following ways is +% recommended. +% +% \begin{itemize} +% \item +% This is the recommended way. PDF output as expected. +% \begin{quote} +% |\documentclass[a4paper,dvipdfmx]{article}|\\ +% |\usepackage{pdfpages}| +% \end{quote} +% +% \item +% Warning. Forcing dvipdfmx.def. PDF output as expected. +% \begin{quote} +% |\documentclass[a4paper]{article}|\\ +% |\usepackage[dvipdfmx]{pdfpages}| +% \end{quote} +% +% \item +% Assuming user wants to use dvips. Therefor pdfpages will just insert +% empty pages. +% \begin{quote} +% |\documentclass[a4paper]{article}|\\ +% |\usepackage{pdfpages}| +% \end{quote} +% \end{itemize} +% +% +% \noindent % Package |graphicx| should be loaded with the |dvipdfmx| driver. % However, \break |\RequirePackage[dvipdfmx]{graphicx}| is not recommended % because it will cause an `option clash' if a user loaded |graphicx| -% with additional options before. Thus, we expect the user to load +% with additional options previously. Thus, we expect the user to load % |graphicx| with |dvipdfmx| driver before loading pdfpages. % \begin{macrocode} \def\AM@tmp{dvipdfmx.def} @@ -3901,23 +3967,76 @@ \input{dvipdfmx.def}% \fi % \end{macrocode} +% Packages like ngerman.sty make " with catcode 11 active. So let's +% use " with catcode 12 to delimit arguments. +% \begin{macrocode} +{\catcode`\"=12 + \gdef\AM@quote{"}% +} +% \end{macrocode} % Get last page number. -% Unfortunately this driver cannot detect the total number of pages of a PDF. -% If `lastpage' is not given we will assume the PDF has got just one page. +% This driver uses the external program |extractbb| to retrieve the total number +% of pages. Many thanks to Noriyuki Abe who provided this code. % \begin{macrocode} -\PackageInfo{pdfpages}{% - Driver `dvipdfmx' cannot detect the total number\MessageBreak - of pages of a PDF. Use option `lastpage' to give\MessageBreak - me a hint} \def\AM@getpagecount{% +% \end{macrocode} +% Try reading |.xbb| file if available. +% \begin{macrocode} + \expandafter\expandafter\expandafter\AM@get@xbb@filename + \csname Gin@rule@.pdf\endcsname\AM@currentdocname + \immediate\openin\@inputcheck=\AM@xbb@filename + \AM@read@xbb\@inputcheck + \immediate\closein\@inputcheck +% \end{macrocode} +% Try reading output of program |extractbb|. +% \begin{macrocode} \ifx\AM@pagecount\AM@undefined - \def\AM@pagecount{1}% + \immediate\openin\@inputcheck=\AM@quote|extractbb -O \AM@currentdocname\AM@quote + \AM@read@xbb\@inputcheck + \immediate\closein\@inputcheck + \fi +% \end{macrocode} +% If all fails set number of pages to 1. Maybe it is a graphics file +% like |jpg|, |png|, etc. +% \begin{macrocode} + \ifx\AM@pagecount\AM@undefined + \def\AM@pagecount{1} \fi } % \end{macrocode} -% Don't check page numbers. +% Construct filename of |xbb| file. +% |#1:{pdf}, #2:{.xbb}, #3:{file.pdf}| % \begin{macrocode} -\newcommand*{\AM@checkpagenumber}[1]{} +\def\AM@get@xbb@filename#1#2#3{% + \filename@parse{#3}% + \edef\AM@xbb@filename{\filename@area\filename@base#2}% +} +% \end{macrocode} +% Read ouput of program |extractbb|. +% \begin{macrocode} +\def\AM@read@xbb#1{% + \@tempswatrue + \loop + \ifeof#1 + \@tempswafalse + \else + \begingroup + \catcode`\%=12\relax + \immediate\global\read#1 to \@tempa + \endgroup + \expandafter\AM@find@pages\@tempa:\relax + \fi + \if@tempswa\repeat +} +% \end{macrocode} +% Find string |%%Pages:| +% \begin{macrocode} +\long\def\AM@find@pages#1:#2\relax{% + \def\@tempb{#1}% + \edef\@tempc{\@percentchar\@percentchar Pages}% + \ifx\@tempb\@tempc\AM@set@pagecount#2\fi +} +\def\AM@set@pagecount#1:{\def\AM@pagecount{#1}} % \end{macrocode} % Page dimensions. % \begin{macrocode} -- cgit v1.2.3