我想生成一个包含页边距的完整页眉。偶数页页眉是正确的。但奇数页页眉不包括左侧的页边距。
\documentclass[12pt]{scrbook}
\usepackage[paperwidth=170mm, paperheight=240mm, left=142pt, top=40pt, textwidth=280pt, marginparsep=20pt, marginparwidth=100pt, textheight=560pt, footskip=40pt
%,bindingoffset=30pt
,asymmetric
,reversemarginpar
,showframe]{geometry}
\usepackage[ilines, headsepline]{scrpage2}
\setheadwidth[0pt]{textwithmarginpar}
\clearscrheadfoot
\ihead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\pagestyle{scrheadings}
\blinddocument
\end{document}
我想实现
现在我得到了
偶数页
奇数页
答案1
编辑:OP 更改了他的问题,因此这个答案已过时。我不会删除它,因为代码可以作为起点。
我必须承认,我不太理解你的设计,但这段代码似乎很接近:
\documentclass[12pt, twoside=semi]{scrbook}
\usepackage[paperwidth=170mm, paperheight=240mm, left=142pt, top=40pt, textwidth=280pt, marginparsep=20pt, marginparwidth=100pt, textheight=560pt, footskip=40pt
%,bindingoffset=30pt
,asymmetric
,reversemarginpar
,showframe]{geometry}
\usepackage[ilines, headsepline, headwidth=340pt]{scrlayer-scrpage}
%\setheadwidth[0pt]{textwithmarginpar}
\clearscrheadfoot
\ihead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\pagestyle{scrheadings}
\blinddocument
\end{document}
您需要最新版本的 KOMA-script (v 3.12)。
答案2
我用 fancyhr 包解决了
\documentclass[twoside=semi]{scrbook}
\usepackage{calc}
% Page layout
\usepackage[paperwidth=170mm, paperheight=240mm, left=142pt, top=40pt, textwidth=280pt, marginparsep=20pt, marginparwidth=100pt, textheight=560pt, footskip=40pt
%,bindingoffset=30pt
%,asymmetric
,reversemarginpar
,showframe]{geometry}
% Head and foot of all pages
\usepackage{fancyhdr}
\usepackage{blindtext}
\begin{document}
\mainmatter
%% headings
\pagestyle{fancy}
%% General setup
%\fancyheadoffset[LO,RE]{-\marginparsep-\marginparwidth}
\fancyheadoffset[LO]{\marginparsep+\marginparwidth}
\fancyheadoffset[LE]{\marginparsep+\marginparwidth}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%% Head
%\fancyhead[RO]{\sffamily\rightmark}
%\fancyhead[LE]{\sffamily\leftmark}
\fancyhead[RE]{\sffamily\leftmark}
\fancyhead[LO]{\sffamily\leftmark}
\fancyhead[LE]{\thepage}
\fancyhead[RO]{\thepage}
%
%% Rules
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{0pt}
%% end headings
%\reversemarginpar
\Blinddocument
\end{document}
奇数页
偶数页