0

How can I put some centered text directly under the headsepline?

enter image description here

\documentclass[fontsize=14pt]{scrreprt}
\usepackage[margin=1.75cm,
 includefoot, includehead, 
showframe=false
headheight=2\baselineskip,
]{geometry}

\usepackage[ headsepline,footsepline]{scrlayer-scrpage}
\chead{Some stuff here... \\ Some stuff there...}
%\addtokomafont{headsepline}{\centering Text directly under headsepline}
\begin{document}
Content...
\end{document}
1
  • 3
    The headsepline separates head from body, hence the name. Use \chead{wombat\\capybara\\\hrule \\ Mara} instead (untested)
    – Johannes_B
    Jan 10, 2019 at 12:11

2 Answers 2

3

You can also declare new layer:

\DeclareNewLayer[
  background,
  headsep,
  contents={\parbox{\layerwidth}{\centering
    Text directly under headsepline}}
]{headseplayer}

and add this layer to the pagestyle:

\AddLayersToPageStyle{scrheadings}{headseplayer}

Example:

\documentclass[fontsize=14pt]{scrreprt}
\usepackage[margin=1.75cm,includeheadfoot,
  %showframe,
  headheight=2\baselineskip,
]{geometry}

\usepackage[ headsepline,footsepline]{scrlayer-scrpage}
\chead{Some stuff here... \\
       Some stuff there}%

\DeclareNewLayer[
  background,
  headsep,
  contents={\parbox{\layerwidth}{\centering
    Text directly under headsepline}}
]{headseplayer}

\AddLayersToPageStyle{scrheadings}{headseplayer}
\begin{document}
Content...
\end{document}

enter image description here

Remark: You have to ensure that the length \headsep is big enough. Maybe you have to set geometry option headsep to an appropriate value.

2
  • How can I set that Layer only at the first (or second) page?
    – cis
    Jan 10, 2019 at 16:52
  • 1
    It depends on what you want do. If you know that the text should only appear at the second page: contents={\ifnum\value{page}=2 ... \fi}. But you can also remove layers from a page style using \RemoveLayersFromPagestyle{<pagestyle>}{<layer list>}.
    – esdd
    Jan 11, 2019 at 13:17
2
\documentclass[fontsize=14pt]{scrreprt}
\usepackage[margin=1.75cm,
 includefoot, includehead,
 showframe=false, %<--- comma was missing
 headheight=2\baselineskip,
]{geometry}

\usepackage[ headsepline,footsepline]{scrlayer-scrpage}
\chead{Some stuff here... \\
       Some stuff there}%
\ohead{\makebox[\textwidth]{%       
        \raisebox{\dimexpr-1.7\baselineskip}[0pt][0pt]{%
        \normalfont Text directly under headsepline}}}

\begin{document}
Content...
\end{document}

enter image description here

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.