# setspace: double spacing messes the predefined position of page number

Referring to my previous question, I was helped to know how to control the page number position, however, when using \doublespacing, the position is messed up as shown below.

How can I keep the same layout including the page number position regardless the line spacing?

## Single spacing

\documentclass{scrreprt}
\usepackage[a4paper,
top=2cm,
bottom=1cm,
includefoot,
left=4cm,
right=2cm,
footskip=1cm]{geometry}
\usepackage{scrlayer-scrpage}
\rofoot*{\pagemark}
\cofoot*{}
\usepackage{lipsum,setspace}

\begin{document}

\chapter{Chapter Title}
\singlespacing
\lipsum[1-20]

\end{document}


## Double spacing

\begin{document}

\chapter{Chapter Title}
\doublespacing
\lipsum[1-20]

\end{document}


• – user36296 May 1 '17 at 15:39
• Your image corresponds to a page number in the header and your code says it should be in the footer. So? – Bernard May 1 '17 at 15:39
• @Bernard The number is in the footer, and the red lines in my images are referring to the offsets from the right and bottom margins. – Diaa May 1 '17 at 15:42
• @samcarter I am sorry, but adding \makeatletter \g@addto@macro\footfont{\setstretch{1}} \makeatother before \begin{document} didn't solve my problem when I test it now. I got this ouput. – Diaa May 1 '17 at 15:48

To get single spaced header and footer on all pages where a layer page style is used, add

\KOMAoptions{onpsinit={\linespread{1}\selectfont}}


Code:

\documentclass{scrreprt}
\usepackage[a4paper,
top=2cm,
bottom=1cm,
includefoot,
left=4cm,
right=2cm,
footskip=1cm]{geometry}
\usepackage[
footsepline,plainfootsepline,% only to show the position of the footer
footbotline,plainfootbotline% only to show the position of the footer
]{scrlayer-scrpage}
\rofoot*{\pagemark}
\cofoot*{}