# Page Numbers for included pdf pages in koma script

I am using the class scrreport with the following setup

\documentclass[11pt,twoside,DIV=12]{scrreprt}


Inside the document I include several pdf files via \includepdf from the pdfpages package. Each included pdf file spans several pages of the correct dimension (A4). I want the included pdf pages to carry page numbers. In this reply, people suggested using

\includepdf[pagecommand={\thispagestyle{plain}}]{some.pdf}


This prints the correct page numbers, however, it makes the page numbers collide with the actual text. After all, the margins of my text and that of the included pdf pages are not compatible.

How can I move the page numbers into the outer margins (twoside) for the imported pdf files without messing around with the header/footer for the normal pages? Do I need to define a new pagestyle for them, i.e. change the width of the footer for these pages? Do I need to change the "margins" for the imported pdf pages via typearea somehow, such that the normal pagestyle plain uses the avaiable space? I can only find answers that refer to fancyhdr or to geometry, which (as far as I understood) are not supposed to be used with koma script. And the documentation for koma script is confusing me more than it helps.

In this other question, the imported pdf pages were supposed to provide different information than the normal plain style. I am totally happy with the simple page number. Only the location is unfortunate.

Any hint is appreciated.

[edit:]

A minimum working example would be composed of two files: The first

\documentclass[10pt]{article}

\usepackage[left=2.5cm,right=2.5cm,top=1cm,bottom=1cm,footskip=0cm]{geometry}
\usepackage{lipsum}
\pagestyle{plain}

\begin{document}
\lipsum[1-24]
\end{document}


generates some text as some.pdf pages. The second

\documentclass[11pt,twoside,DIV=12]{scrreprt}

\usepackage{lipsum}
\usepackage{pdfpages}

\begin{document}
\chapter{Regular Pages}
\lipsum[1-6]
\section{More Text}
\lipsum[7-14]
\chapter{Imported Pages}
In the following I provide imported pages.
\includepdf[pages=1-2,pagecommand={\thispagestyle{plain}}]{some.pdf}
\end{document}


imports some pages and adds its own plain page numbers. The first included pdfpage now has the normal imported text (including its own pagenumber 1), as well as the added pagenumber 5, which collides with the imported text:

How do I move the pagenumber 5 into the outer margins, without changing the setup of the other pages? I especially want page number 2 to still look like this:

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Skillmon Apr 9 '18 at 17:08

You could clone pagestyle scrheadings and change the width of the footer. This must be done after all settings/changes for scrheadings like \ifoot etc.

\documentclass[11pt,twoside,DIV=12]{scrreprt}
\usepackage{lipsum}
\usepackage{pdfpages}

\KOMAoptions{footwidth=\textwidth+2cm:0pt}%
}

\begin{document}
\chapter{Regular Pages}
\lipsum[1-6]
\section{More Text}
\lipsum[7-14]
\chapter{Imported Pages}
In the following I provide imported pages.
\includepdf[pages=1-2,pagecommand={\thispagestyle{plain.pdfpages}}]{some.pdf}
\chapter{Next Pages}
\lipsum[15-28]
\end{document}


You could also use \clearpage, \KOMAoptions and \includepdf inside a group:

\documentclass[11pt,twoside,DIV=12]{scrreprt}
\usepackage{lipsum}
\usepackage{pdfpages}

\begin{document}
\chapter{Regular Pages}
\lipsum[1-6]
\section{More Text}
\lipsum[7-14]
\chapter{Imported Pages}
In the following I provide imported pages.
{%
\clearpage
\KOMAoptions{footwidth=\textwidth+2cm:0pt}%
\includepdf[pages=1-2,pagecommand={\thispagestyle{plain}}]{some.pdf}%
}
\chapter{Next Pages}
\lipsum[15-28]
\end{document}


The result is the same as above.