我试图使页眉和页脚横跨整个页面宽度,但页眉和页脚内容不应移动到一侧。
我目前的方法看起来像这样,但它给了我错误的结果
\documentclass[
oneside,
parskip=half-
]{scrreprt}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\ohead{Sample Text}
\KOMAoptions{%
headsepline=1.5pt,
footsepline=1.5pt}
\KOMAoptions{%
headwidth=\pdfpagewidth,%
footwidth=\pdfpagewidth,%
}
% second line in header ----------------------------------------------
\DeclareNewLayer[
clone=scrheadings.head.below.line, % clone this layer
addvoffset=2pt, % shift it down
addhoffset=-4pt, % shift it left so its centered
contents={\addtokomafont{headsepline}{\color{cyan}} \KOMAoptions{headsepline=.5pt} % change the line color and width
\GetLayerContents{scrheadings.head.below.line}}, % use the same code as headsepline
]{scrheadings.head.below.secondline}
\AddLayersToPageStyle{scrheadings}{scrheadings.head.below.secondline} % add the layer to the page style
% second line in footer ----------------------------------------------
\DeclareNewLayer[
clone=scrheadings.foot.above.line, % clone this layer
addvoffset=2pt, % shift it down
addhoffset=-4pt, % shift it left so its centered
contents={\addtokomafont{footsepline}{\color{cyan}} \KOMAoptions{footsepline=.5pt} % change the line color and width
\GetLayerContents{scrheadings.foot.above.line}}, % use the same code as headsepline
]{scrheadings.foot.above.secondline}
\AddLayersToPageStyle{scrheadings}{scrheadings.foot.above.secondline} % add the layer to the page style
\begin{document}
This is not important
\end{document}
如您所见,页眉的内容在页面边缘被截断。使用 \vspace 无法解决我的问题,而且我通过搜索没有找到任何其他解决方案。