我正在嘗試使 headerline 和 footepline 跨越頁面的整個寬度,但頁首和頁腳內容不應移動到一側。
我目前的方法看起來像這樣,但它給了我錯誤的結果
\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 無法解決我的問題,並且透過搜尋也沒有找到任何其他解決方案。