pdfpages

43 views
Skip to first unread message

Ian Fantom

unread,
Mar 21, 2025, 6:19:32 AMMar 21
to latexus...@googlegroups.com

I'm now trying to include a pdf file (for the first time) - still using XeLatex in Texstudio.

I've followed this in the readme file:

The pdfpages Package *
Andreas Matthias
andreas....@gmail.com
2017/10/31
Abstract
This package simplifies the insertion of external multi-page PDF or PS doc-
uments. It supports pdfTeX, VTeX, XeTeX, LuaTeX, and pTeX.

- ------------

E.g.: pages=- will insert all pages of the document, and pages=last-1
will insert all pages in reverse order.
(Default: pages=1)

- -------------

The relevant lines in the Latex file are:

- -----------------------------------------

\usepackage[final]{pdfpages} % 2025-03-20

\mainmatter

\includepdf[pages=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

- -----------------------------------------

When I comment out the '\includepdf' line the file compiles nicely.

With: \includepdf[pages=3-5]{sub_la_verda_bluzo_por_afrikanoj.pdf} I get the same first error.

I've tried different values for 'pages' and different pdf files, with similar results.

The error messages for the first mentioned above (pages=-) are:

- ------------------------------------------

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Illegal unit of measure (pt inserted). ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing = inserted for \ifdim. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Illegal unit of measure (pt inserted). ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Illegal unit of measure (pt inserted). ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Package calc Error: `a' invalid at this point. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Extra }, or forgotten \endgroup. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Improper \prevdepth. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing \endgroup inserted. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing } inserted. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Package xkeyval Error: `pages' undefined in families `Gin'. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: File `' not found. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Illegal unit of measure (pt inserted). ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Illegal unit of measure (pt inserted). ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: File `' not found. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Missing number, treated as zero. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 139: Undefined control sequence. ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

line 7: No hyphenation patterns were loaded for `Esperanto'(polyglossia) I will use \language=\l@nohyphenation instead

line 7: \setlocalhyphenmin useless for unhyphenated language esperanto

: Unused global option(s): [esperanto].

: Rerun to get /PageLabels entry.

: old toc file detected, not used; run LaTeX again.

- ------------------------

Regards,

Ian


Peter Flynn

unread,
Mar 21, 2025, 11:53:34 AMMar 21
to latexus...@googlegroups.com
On 21/03/2025 10:19, Ian Fantom wrote:
> I'm now trying to include a pdf file (for the first time)
[...]
> \usepackage[final]{pdfpages} % 2025-03-20
>
> \mainmatter
>
> \includepdf[pages=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}
[...]
> line 139: Undefined control sequence. ...=-]
> {sub_la_verda_bluzo_por_afrikanoj.pdf}

There is something seriously wrong with pdfpages here. I have just done
this on a local 38pp document:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{doughnutEB.pdf}
\end{document}

and it goes all the way through OK. I'm using version 2024-01-21 of
pdfpages. I've used pdfpages on and off for years and it has not given
any problems like this. It uses a number of support packages, including
keyval.sty, which deals with getting the values from key=value options,
but again this is pretty robust. It looks to me like a package version
conflict.

Can you add \listfiles immediately before your \begin{document}? This
will list all the packages being used. Mine says (using LuaLaTeX, but I
also tested with XeLaTeX and pdflatex):

*File List*
article.cls 2023/05/17 v1.4n Standard LaTeX document class
size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
pdfpages.sty 2024/01/21 v0.5y Insert pages of external PDF documents (AM)
ifthen.sty 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
calc.sty 2023/07/08 v4.3 Infix arithmetic (KKT,FJ)
eso-pic.sty 2023/05/03 v3.0c eso-pic (RN)
keyval.sty 2022/05/29 v1.15 key=value parser (DPC)
xcolor.sty 2023/11/15 v3.01 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
xetex.def 2022/09/22 v5.0n Graphics/color driver for xetex
mathcolor.ltx
graphicx.sty 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2021/08/11 v1.11 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
ppxetex.def 2024/01/21 v0.5y Pdfpages driver for XeTeX (AM)
l3backend-xetex.def 2024-01-04 L3 backend support: XeTeX
ts1cmr.fd 2023/04/13 v2.5m Standard LaTeX font definitions
pdflscape.sty 2022-10-27 v0.13 Display of landscape pages in PDF
pdflscape-nometadata.sty 2022-10-28 v0.13 Display of landscape pages
in PDF
(HO)
iftex.sty 2022/02/03 v1.0f TeX engine tests
lscape.sty 2020/05/28 v3.02 Landscape Pages (DPC)
doughnutEB.pdf Graphic file (type pdf)
[repeated × 37]
***********

Peter

Ian Fantom

unread,
Apr 9, 2025, 11:32:43 AMApr 9
to latexus...@googlegroups.com
Thanks. Where should the File List appear? In the log file or in the
document?

The problem is that it doesn't compile, so it can't appear in the
document. No File List appears in the log file. What does appear in the
log file is:

= ==================

! Undefined control sequence.
\maxwidth ->\ifdim \Gin@n
                          at@width>\linewidth \linewidth \else
\Gin@nat@widt...
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again>
                   a
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again>
                   a
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing = inserted for \ifdim.
<to be read again>
                   a
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again>
                   a
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again>
                   a
l.149 ...=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

= ===================== =

Regards,

Ian

Peter Flynn

unread,
Apr 9, 2025, 12:37:32 PMApr 9
to latexus...@googlegroups.com

In the log file and in the terminal. But if it's giving errors you have to fix them first.


--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to latexusersgro...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/latexusersgroup/73fadcf7-580a-4b5b-bcbb-db5acc12a374%40fantom.org.uk.

Peter Flynn

unread,
Apr 9, 2025, 12:37:58 PMApr 9
to latexus...@googlegroups.com

Out to dinner now, back later

Ian Fantom

unread,
Apr 9, 2025, 1:00:09 PMApr 9
to latexus...@googlegroups.com

Same here!

The errors arise entirely from the pdfpages lines.

Ian

Peter Flynn

unread,
Apr 9, 2025, 4:39:20 PMApr 9
to latexus...@googlegroups.com
On 09/04/2025 17:59, Ian Fantom wrote:
> Same here!
>
> The errors arise entirely from the pdfpages lines.

But...earlier you said

>> There is something seriously wrong with pdfpages here. I have just
>> done this on a local 38pp document:
>>
>> \documentclass{article}
>> \usepackage{pdfpages}
>> \begin{document}
>> \includepdf[pages=-]{doughnutEB.pdf}
>> \end{document}

>> >> \includepdf[pages=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}

Rename the PDF file to something without underscores and try that.

Peter

Ian Fantom

unread,
Apr 9, 2025, 5:35:50 PMApr 9
to latexus...@googlegroups.com

On 09/04/2025 21:39, Peter Flynn wrote:
> On 09/04/2025 17:59, Ian Fantom wrote:
>> Same here!
I meant I was off for a meal, too!
>>
>> The errors arise entirely from the pdfpages lines.
>
> But...earlier you said
>
>>> There is something seriously wrong with pdfpages here. I have just
>>> done this on a local 38pp document:
>>>
>>> \documentclass{article}
>>> \usepackage{pdfpages}
>>> \begin{document}
>>> \includepdf[pages=-]{doughnutEB.pdf}
>>> \end{document}
>
>>>         >> \includepdf[pages=-]{sub_la_verda_bluzo_por_afrikanoj.pdf}
>
> Rename the PDF file to something without underscores and try that.

I've just tried

\includepdf[pages=-]{sublaverdabluzoporafrikanoj.pdf}

Same result.

I think I'll have to create a test document with minimal markings and
see if I can get that to work. My header is adapted from an
automatically created one in converting from Libreoffice Writer to
Latex. It's possible there's too much code.

Regards,

Ian

Ian Fantom

unread,
Apr 11, 2025, 7:21:14 AMApr 11
to latexus...@googlegroups.com
I've just tried commenting out various lines in the header to reduce the
code as much as possible, and have now found that the \includepdf
command works when I remove the line:

\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}

I haven't yet figured out what that line does, other than that it scales
default graphics. It's one that I inherited from the automatic
conversion from Libreoffice Writer under Ubuntu to Latex. Is it trying
to scale the pdf file and somehow crashing it?

Regards,

Ian

Peter Flynn

unread,
Apr 11, 2025, 7:56:19 AMApr 11
to latexus...@googlegroups.com

On 11/04/2025 12:21, Ian Fantom wrote:
> I've just tried commenting out various lines in the header to reduce the
> code as much as possible, and have now found that the \includepdf
> command works when I remove the line:
>
> \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}

Remove it from where? Your own code, or the includepdf.sty file?

> I haven't yet figured out what that line does, other than that it scales
> default graphics.

It makes the image as big as it can be, the maximum height AND maximum
width BUT only whichever one still allows the image to retain its aspect
ratio.

But I don't know why you are including this. It's what includepdf does
by default.

> It's one that I inherited from the automatic conversion from
> Libreoffice Writer under Ubuntu to Latex. Is it trying to scale the
> pdf file and somehow crashing it?
Probably yes. I never use stuff from automated conversions except to
examine and see if they make sense.

Wordprocessor conversions to LaTeX suffer from the delusion that you
want an EXACT copy, which in 99.999% of cases is completely wrong — you
want a conversion of the text and structure (headings, lists, etc) but
with no fancy preformatting. The Libre Office conversion even used to
try and force paragraph width and line spacing down to the 0.0001pt
level in a futile and misguided belief that that was how to convert a
document.

Some ray of hope is that the conversion in AbiWord (which also reads
DOCX format offers TWO LaTeX conversions: one with microformatting and
one without. The one without is actually very good. Even better is the
conversion to DocBook XML, because you can then tailor an XSLT
transformation to create LaTeX and other formats yourself.

Peter

Ian Fantom

unread,
Apr 12, 2025, 6:56:17 AMApr 12
to latexus...@googlegroups.com
Yes, I removed \setkeys from my code - the header code I had got from
pandoc. I didn't realise it was in pdfpages. It seems the two
invocations clashed.

I was learning Latex by converting a document from LibreOffice Writer,
then figuring it out. That led to an awful lot of work, as I removed
unnecessary code and simplified the coding. I've since realised a better
way to convert is to save my LibreOffice file as text (UTF), add the
\chapter tag where appropriate, then run a simple Perl script to
separate out the chapters into separate files. Then add the Latex labels
by hand. In a typical document there aren't a lot of labels to learn.

In the end it turned out that my pdf file had some formatting problems,
so I couldn't just include it anyway. Eventually I converted to text
then edited as above and ran my Perl script. Next I'm about to edit in
Latex.

But the experience has been useful, because I shall need pdfpages for
something else shortly. Many thanks, Peter!

Regards,

Ian
Reply all
Reply to author
Forward
0 new messages