I want to vary my linespacing in my LaTeX document. I want the footer, headlines and other parts of the document to be at onehalfspacing, but the main text to be doublespacing.
My solution was to use setspace with \doublespacing in the text and also the footer to specify it for every text. Similar to this thread: https://tex.stackexchange.com/a/542102
\documentclass[fontsize = 12pt]{scrreprt}
\usepackage{lmodern} % for different font style
\usepackage{lipsum} % for dummy text
\usepackage{tabularx} % for tabulars
\usepackage{booktabs} % for tabular functions
\usepackage{scrlayer-scrpage} % for modifying footer
\clearpairofpagestyles % remove standard style (removes default pagenumbering)
\usepackage[onehalfspacing]{setspace} % change linespace to 2
% defining the footer
\newcommand{\footerON}
{
\ifoot[ % footer for even pages
\onehalfspacing
\begin{tabularx}{\textwidth}{m{0.79\textwidth}Xr} % create tabular over textwidth
\midrule % horizontal line over footer
A long title of my document which stretches over two lines created by KarateKlaus & &
\thepage % pagenumbering on the right
\end{tabularx}
\doublespacing
]
{ % same footer for odd pages
\onehalfspacing
\begin{tabularx}{\textwidth}{m{0.79\textwidth}Xr}
\midrule
A long title of my document which streches over two lines created by KarateKlaus & &
\thepage
\end{tabularx}
\doublespacing
}
}
\newcommand{\footerOFF}{\ifoot[]{}}
\begin{document}
\footerON
\chapter{multiline chaptertitle to test the linespaceing}
\doublespacing
\lipsum[1-1]
\par
\onehalfspacing
\section{multiline sectiontitle to test the linespaceing in a section}
\doublespacing
\lipsum[1-3]
\par
\onehalfspacing
\end{document}
The problem with this methode seems to be that the horizontal line over the footer isn't the same height through the document. When a paragraph continues at the next side, the whole footer moves down just so slightly.
Is there a way to fixate the footer or at least counter my problem?

