
我嘗試禁用某個部分的第一頁上的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}