3

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*{}
\pagestyle{plain.scrheadings}
\usepackage{lipsum,setspace} 

\begin{document}

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

\end{document}

enter image description here


Double spacing

\begin{document}

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

\end{document}

enter image description here

  • 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 Many thanks for your helpful links, could you please post it as an answer to accept it? – Diaa May 1 '17 at 15:44
  • @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
5

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

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

to your preamble.

enter image description here

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}
\KOMAoptions{onpsinit={\linespread{1}\selectfont}}% <- added
\rofoot*{\pagemark}
\cofoot*{}
\pagestyle{plain.scrheadings}
\usepackage{lipsum,setspace}

\begin{document}
    \chapter{Chapter Title}
    \singlespacing
    \lipsum[1-19]
    \chapter{Chapter Title}
    \doublespacing
    \lipsum[1-19]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.