# Base document page numbers with pdfpages

I'm writing a report, in LaTeX. And I need to include, as appendices, other latex documents I have written. I am currently doing this using `pdfpages` and it works. However, the inserted PDF has no page numbers and it overlays my base documents page numbering, resulting in no page numbers on the PDF pages. My questions:

1. How to solve the above problem.
2. Is there a better way to do this.
-
As far as I know, pdfpages simply embeds the pages from the other PDFs without recompiling them. I don't think PDF pages has the capacity to edit the inserted PDF at all. If the appendices are your own, why not insert the source with `\include` or `\input`? That way it'll recompile and produce consistent page numbers. –  Warrick Aug 18 '11 at 15:13
I initially did try with both, using \input it would not compile (not sure why) with \include it compiled but the included document wasnt there. So pdf pages provided the simplest solution. –  Rabid.Eeyore Aug 19 '11 at 7:13

## migrated from stackoverflow.comAug 18 '11 at 13:48

This question came from our site for professional and enthusiast programmers.

`pdfpages` provides the `pagecommand` option for `\includepdf`, which can be used to apply a page style for each page, to print headings and more. For example, add plain page style or your own page style to get page numbers on all included pages:

``````\includepdf[pages=-,pagecommand=\thispagestyle{plain}]{filename}
``````
-
Thanks, works great. –  Rabid.Eeyore Aug 19 '11 at 7:17
This was better for me: tex.stackexchange.com/a/21249/1567 –  Wok Aug 30 '13 at 21:14

You can also include the next command, for all pdfs that will be put into the document,

``````\includepdfset{pagecommand=\thispagestyle{plain}}
``````

This command goes after `\usepackage{pdfpages}`.

-
`\includepdf[pages=myPageNumber, pagecommand={}]{myPresentation.pdf}`