
Я пытаюсь отключить 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}