我尝试禁用某个部分第一页上的 ohead(仅限第一页)。我尝试了很多方法(例如 \thispagestyle),但都不起作用。
\documentclass[paper=a4,fontsize=12pt,parskip=half,bibliography=totoc,listof=totoc,headings=normal]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[headsepline,plainheadsepline,footsepline,plainfootsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\automark{section}
\clearscrheadfoot
\ihead{Mr. XY}
\ohead{\headmark}
\ofoot[\pagemark]{\pagemark}
\begin{document}
\section{first}
%here comes a lot of text...
%ein I don't want to have "first" in the header
\section{second}
%here comes a lot of text again...
\end{document}
希望有人能帮我解决这个问题。谢谢。
答案1
以下示例使用页面样式plain.scrheadings
,可以使用可选参数 和 来\ihead
定义\ohead
。
然后,它添加补丁以从带有部分开始的页面的标题中\section
添加\thispagestyle{plain.scrheadings}
内容并删除。\headmark
\documentclass[
paper=a4,
fontsize=12pt,
parskip=half,
bibliography=totoc,
listof=totoc,
headings=normal
]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lipsum}
\usepackage[
headsepline, plainheadsepline,
footsepline, plainfootsepline
]{scrlayer-scrpage}
\pagestyle{scrheadings}
\automark{section}
\clearscrheadfoot
\ihead[Mr. XY]{Mr. XY}
\ohead[]{\headmark}
\ofoot[\pagemark]{\pagemark}
\let\orgsection\section
\def\section#1#{%
\auxsection{#1}%
}
\def\auxsection#1#2{%
\orgsection#1{#2}%
\thispagestyle{plain.scrheadings}%
}
\begin{document}
\section{first}
\lipsum[2-12]
\section{second}
\lipsum
\end{document}