특정 페이지의 헤더에서 섹션 제목을 제거하고 fancyhdr을 사용하여 페이지 번호를 유지하려면 어떻게 해야 합니까?

특정 페이지의 헤더에서 섹션 제목을 제거하고 fancyhdr을 사용하여 페이지 번호를 유지하려면 어떻게 해야 합니까?

며칠 전부터 페이지의 헤더를 제거하고 페이지 번호를 유지하려고 노력하고 있습니다. 여기 내 작업 예가 있습니다. 문제는: 을 사용하여 헤더를 제거하면 \thispagestyle{plain}페이지 번호도 제거된다는 것입니다. 첫 번째 페이지는 누락된 번호를 제외하고는 올바르게 작동합니다. 두 번째 페이지가 맞습니다.

\documentclass[a4paper,11pt]{article}
\usepackage[ngerman]{babel} 
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}} % set the \leftmark
\fancyhf{}
\fancyhead[L]{\leftmark} % 1. sectionname
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand{\headrulewidth}{0.0pt}%
}
\begin{document}
\section{Titel}
\thispagestyle{plain}
\lipsum[2-10]
\end{document}

답변1

발행하면 \fancyhf{}머리글과 바닥글이 모두 지워집니다. 따라서 스타일을 재정의할 때 plain존재하는 머리글과 바닥글을 모두 지웁니다. \fancyfoot[C]{\thepage}재정의의 일부로 다음 을 포함하여 바닥글을 다시 설정합니다 .

\documentclass{article}
\usepackage{lipsum,fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}} % set the \leftmark
\fancyhf{}% Clear header/footer
\fancyhead[L]{\leftmark} % 1. sectionname
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{% Redefine plain pages tyle
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{0.0pt}%
  \fancyfoot[C]{\thepage}
}
\begin{document}
\section{Titel}
\thispagestyle{plain}
\lipsum[2-10]
\end{document}

관련 정보