8

I'm writing an article using KOMA-script scrartcl class. The main text uses \onehalfspacing option from setspace package. In my article I have headings with couple lines of text set up using scrpage2 package. What I'm trying to achieve is to use \singlespacing only in headings.

Something like this:

\documentclass[fontsize=14pt,headlines=3,headinclude]{scrartcl}
\usepackage{xltxtra}
\setmainfont{CMU Serif}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{scrpage2}
\chead{Some really long text\\ that takes\\more than one line}
\pagestyle{scrheadings}

\begin{document}
\onehalfspacing
\lipsum
\end{document}

Result

I'd like that some really long text to have single spacing. Is it possible? Reading KOMA-script manual I didn't find anything suggesting about spacing in headings.

2
  • 2
    How about \chead{\parbox{\textwidth}{\singlespacing\centering ..}}?
    – Werner
    Oct 23, 2013 at 20:50
  • Thanks for quick reply. It kind of does that, but header's top margin increases instead of heading itself shifting top. I mean, it leaves more whitespace on top of the page. Probably could be fixed by doing something with text area height?
    – Kona-chan
    Oct 23, 2013 at 20:59

3 Answers 3

5

First, prepend \setstretch{1} to the argument of \chead. (Don't use \singlespacing because that would add extra space at the start.) Second, because a singlespaced line's height is 0.8 times the height of a onehalfspaced line, change headlines=3 to headlines=2.4.

\documentclass[fontsize=14pt,headlines=2.4,headinclude]{scrartcl}
\usepackage[onehalfspacing]{setspace}
\usepackage{lipsum}
\usepackage{scrpage2}
\chead{\setstretch{1}Some really long text\\ that takes\\more than one line}
\pagestyle{scrheadings}
\begin{document}
\lipsum
\end{document}
1
  • This is it, much appreciated!
    – Kona-chan
    Oct 23, 2013 at 21:11
3

I'd use a \parbox; but since scrpage2 already uses a \parbox itself for placing the header, the final result will be almost unpredictable, unless we do the trick of hiding the height of the box

\documentclass[fontsize=14pt,headlines=3,headinclude]{scrartcl}
\usepackage[pass,showframe]{geometry} % just to draw frames
\usepackage{fontspec}
\setmainfont{CMU Serif}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{scrpage2}
\chead{%
  \parbox[b][0pt]{\textwidth}{
  \singlespacing\centering
    Some really long text\\
    that takes\\
    more than one line\vspace{-\dp\strutbox}
  }%
}

\pagestyle{scrheadings}

\begin{document}
\onehalfspacing
\lipsum
\end{document}

The final \vspace is meant to push the bottom line in the “really correct” position (a couple of points, actually).

enter image description here

3

Since 2013 scrpage2 is obsolete. Since version 3.24 the official successor scrlayer-scrpage has an option singlespacing to set the page head and footer in singlespacing:

\documentclass[fontsize=14pt,headlines=3,headinclude]{scrartcl}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage[singlespacing]{scrlayer-scrpage}
\chead{Some really long text\\ that takes\\more than one line}
\pagestyle{scrheadings}

\begin{document}
\onehalfspacing
\lipsum
\end{document}

results in:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .