# includepdf with page numbers: How to move the re-position numbers?

I am creating a PDF that includes many external PDFs, and want to insert a ToC page as well as page numbering. Using the following code I can achieve this, but the problem is that the location of the page numbers interferes with the PDFs I am importing.

Is there any straightforward way of putting the page numbers in the far left corner instead? I am aware that this is not a problem of the pdfpages package.

\documentclass{article}
\usepackage{pdfpages}
\usepackage[utf8]{inputenc}

\begin{document}

\tableofcontents

%%% File 1 %%%
1,section,1,CV,p1}]
{CV.pdf}

%%% File 2 %%%
1,section,1,Reference 1,p1}]
{ref1.pdf}

\end{document}

• Welcome to TeX.SE. The CV.pdf and ref1.pdf files do not have page numbers themselves? – user31729 Mar 1 '18 at 15:56
• Some do, but not all (there are additional PDFs that I didn't include in the example code). Even if they have page numbers, that doesn't correspond to the actual page numbers in the new PDF file. – arvchi Mar 1 '18 at 16:08

I am explicitly not using the twoside option here, but the page numbers can be printed at the lower left or right corner depending on whether the page number is odd or even.

pagecommand{\thispagestyle{includedpages}} switches into this page style, the regular pages do use the default plain style. (unless changed)

The files CV.pdf and rev.pdf do not contain page numbers and can be generated easily with tex, using blindtext package.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}

\usepackage[showframe]{geometry}
\usepackage{fancyhdr}

\fancypagestyle{includedpages}{%
\fancyhf{}%
\fancyfoot[L]{\ifodd\value{page}\else\thepage\fi}%
\fancyfoot[R]{\ifodd\value{page}\thepage\fi}%
}

\usepackage{blindtext}

\begin{document}

\tableofcontents

\section{Regular content One}

\blindtext[20]

\section{Included content}

%%% File 1 %%%

%%% File 2 %%%

\section{Regular content Two}

\blindtext[20]

\end{document}


Code for CV.tex

\documentclass{article}

\usepackage{blindtext}

\pagestyle{empty}
\begin{document}
\section{Beginning \jobname}
\blindtext[50]
\end{document}

• Thank you. How can I make this not switch between left and right, but stay consistent? Also, is there any way of putting the number even more towards the edge, i.e. decrease margin without changing the margins globally? – arvchi Mar 1 '18 at 17:31
• @zanyar: Actually, switching left/right is consistent unless centering the page number, in which case it is not that important – user31729 Mar 1 '18 at 17:40
• Still, is it possible to not make it switch? And also, is it possible to move it further away towards the page edges? – arvchi Mar 1 '18 at 17:46
• @zanyar: The switch is easy. Replace the line \fancyfoot[L]{\ifnum....} by \fancyfoot[L]{\thepage} and remove \fancyfoot[R]{....} – user31729 Mar 1 '18 at 17:51
• Thanks, it works. What about the margins, guess that's harder to fix? I managed to use \usepackage[margin=0.7in]{geometry} to fix this, however this ruins my title page with ToC. If there was a way to keep default margins on the first page, that would be great. – arvchi Mar 2 '18 at 8:53