1

\includepdf always inserts the first page of the PDF, even if I specify which page I want to insert.

Start with a three-page PDF file, generated by external.tex:

\documentclass[a4paper]{article}
\begin{document}
Page 1

\newpage
Page 2

\newpage

Page 3
\end{document}

Then use this code:

\documentclass[a4paper]{article}
\usepackage[final]{pdfpages}
\begin{document}
\includepdf[pages={2}]{external.pdf}
\end{document}

The resulting document shows “Page 1”, instead of “Page 2”.

I get the same behavior from xelatex and pdflatex. I'm using MikTeX, and all of my packages are up to date. EDIT: I have run the update wizard both as a user and as an admin.

This is similar to this question, but that is evidently a separate issue, because the answers there do not work: I am specifying which pages to insert, and all of the filenames are in lowercase.

EDIT: Here is the log file:

This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6600) (preloaded format=xelatex 2018.3.3)  4 MAR 2018 12:13
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 73 language(s) loaded.
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdfpages\pdfpages.sty"
Package: pdfpages 2017/10/31 v0.5l Insert pages of external PDF documents (AM)

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ifthen.sty"
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\calc.sty"
Package: calc 2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count87
\calc@Bcount=\count88
\calc@Adimen=\dimen103
\calc@Bdimen=\dimen104
\calc@Askip=\skip43
\calc@Bskip=\skip44
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count89
\calc@Cskip=\skip45
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\eso-pic\eso-pic.sty"
Package: eso-pic 2015/07/21 v2.0g eso-pic (RN)

("D:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\atbegshi.sty"
Package: atbegshi 2016/06/09 v1.18 At begin shipout hook (HO)

("D:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
))
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\xcolor\xcolor.sty"
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics-cfg\color.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: xetex.def on input line 225.

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics-def\xetex.def"
File: xetex.def 2016/07/11 v4.10 LaTeX color/graphics driver for XeTeX (L3/RRM/
JK)
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
))
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: xetex.def on input line 99.
)
\Gin@req@height=\dimen105
\Gin@req@width=\dimen106
)
\AM@pagewidth=\dimen107
\AM@pageheight=\dimen108

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdfpages\ppxetex.def"
File: ppxetex.def 2017/10/31 v0.5l Pdfpages driver for XeTeX (AM)
)
\AM@pagebox=\box26
\AM@global@opts=\toks15
\AM@toc@title=\toks16
\c@AM@survey=\count90
\AM@templatesizebox=\box27
) (test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
\AtBeginShipoutBox=\box28
 ("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\oberdiek\pdflscape.sty"
Package: pdflscape 2016/05/14 v0.11 Display of landscape pages in PDF (HO)

("D:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\lscape.sty"
Package: lscape 2000/10/22 v3.01 Landscape Pages (DPC)
)
("D:\Program Files (x86)\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
Package pdflscape Info: Auto-detected driver: dvipdfm (xetex) on input line 99.

)
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
File: external.pdf Graphic file (type QTm)
<use  "external.pdf" >
 [1

]
(test.aux) ) 
Here is how much of TeX's memory you used:
 2095 strings out of 427846
 27745 string characters out of 3151564
 96275 words of memory out of 3000000
 6068 multiletter control sequences out of 15000+200000
 3648 words of font info for 15 fonts, out of 3000000 for 9000
 1328 hyphenation exceptions out of 8191
 37i,18n,39p,253b,430s stack positions out of 5000i,500n,10000p,200000b,50000s

Output written on test.pdf (1 page).
  • 2
    Testing your code, I see Page 2 .... are you really sure you are including the correct external.pdf file? Perhaps you changed the working directory and there is another external.pdf, from a test etc? – user31729 Mar 3 '18 at 9:19
  • Yeah, there's only one version of it. I also got the same behavior with two other PDF files (one related to the thing I'm actually trying to do, one totally random). – adam.baker Mar 3 '18 at 10:08
  • Well, I have no clue right now for your issue. What happens if you use pages=- instead? – user31729 Mar 3 '18 at 11:31
  • 1
    Works for me on an updated MikTeX with pdfLaTeX, LuaLaTeX and XeLaTeX. What does the .log file look like? – moewe Mar 3 '18 at 12:46
  • 1
    @adam.baker No, it's fine. After all you found the problematic package. I think the files like xetex.def were only recently moved to a new package (namely graphics-def), earlier they were part of another package. This may explain why you didn't get the updates if the MikTeX package manager did not install the new package automatically and did not remove the other files from the old package. – moewe Mar 4 '18 at 9:56
1

I was able to solve the problem by installing the graphics-def package.

Following @moewe's comment, I tried to find out why I had an old version of tex\latex\graphics-def\xetex.def. This answer suggested installing graphics-def.

Presumably this is a dependency that should be made explicit; or perhaps xetex.def should be updated automatically somehow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.