단일 페이지에서 ohead 비활성화

단일 페이지에서 ohead 비활성화

섹션의 첫 번째 페이지(첫 번째 페이지만)에서 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}

관련 정보