KOMA-Script:如何将文本直接放在标题行下方?

KOMA-Script:如何将文本直接放在标题行下方?

我怎样才能将一些居中的文本直接放在标题栏下方?

在此处输入图片描述

\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

您还可以声明新层:

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

并将此层添加到页面样式中:

\AddLayersToPageStyle{scrheadings}{headseplayer}

例子:

\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}

在此处输入图片描述

备注:你必须确保长度\headsep足够大。也许你必须将几何选项设置headsep为合适的值。

答案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}

在此处输入图片描述

相关内容