Menu

#14 Interaction of scrlayer and setspace (\ht\strutbox changes)

once upon a time
new-feature
2023-02-20
2021-08-24
Marei
No

I am not quite sure if this is an issue or intended. So treat it like a question until confirmed ;-)

scrlayer is placing the content of layer in mode=text by \ht\strutbox below the top. This \ht\strutbox depends on the default setting which might change in the middle of the document. This might lead to unexpected changes in the pagestyle alignment. I got a report on the pagenumber shifting for tuda-ci. The corresponding issue I received on github is placed here: https://github.com/tudace/tuda_latex_templates/issues/332

Maybe it would help to do the calculations only on activation. But I expect this to cause other issues.

Example: One can see a change within the distance between the page number and the rule.
scrlayer-scrpage is used to simplify the illustration. This can be constructed with scrlayer itself showing the same problem.

\documentclass[
    footsepline=true
]{scrartcl}
\usepackage{scrlayer-scrpage}
\usepackage{setspace}

\begin{document}
    \null

    \newpage
    \setstretch{1.5}
    \null
\end{document}

Discussion

  • Markus Kohm

    Markus Kohm - 2021-08-24

    This is intended. You can use option singlespacing to avoid it an set the head and foot always with single spacing:

    \documentclass[
        footsepline=true
    ]{scrartcl}
    \usepackage[singlespacing]{scrlayer-scrpage}
    \usepackage{setspace}
    
    \begin{document}
        \null
    
        \newpage
        \setstretch{1.5}
        \null
    \end{document}
    

    Calculation on activation could be done, but could lead to problems with calculated line heightreal line height. In this case more smashes would be needed to avoid such problems. And also the position of the baseline could become tricky, depending on the placed text. So I think, option singlespacing is the best, which can be done. Maybe an explicite, optional setting of other spacings would also be possible if needed. In this case, I would have to change the \if@ps@singlespacing\linespread{1}\selectfont\fi into something like \if@ps@explicitespacing\linespread{\scrlayer@linespread}\selectfont\fi. Do you need something like this?

     

    Last edit: Markus Kohm 2021-08-24
  • Marei

    Marei - 2021-08-24

    Thanks a lot :)

    singlespacing is totally fine for that usecase because we don't have multi-line header/footers there.

    I am not sure if a specific linespread setting is required, because one who is getting that deep into it might probably configure the layer on his own, which is still possible by using mode=picture.

     
  • Markus Kohm

    Markus Kohm - 2021-08-24
    • labels: scrlayer --> scrlayer, feature request
     
  • Markus Kohm

    Markus Kohm - 2021-08-24

    For newly defines layers resp. layer page styles setting the mode is indeed not a problem. But for the already existing layers of, e.g., scrlayer-scrpage it shouldn't be done. So maybe such an option could be a good idea.

    I've marked the issue as feature request. But I do not know, if I will really implement it (if noone asks for it).

     
    👍
    1
  • Markus Kohm

    Markus Kohm - 2021-10-15
    • Milestone: KOMA-Script 3.35 --> once upon a time
     
  • Markus Kohm

    Markus Kohm - 2023-02-20
    • status: open --> new-feature
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.