我在這裡嘗試了這個答案回憶錄班但在我的情況下不起作用,我設法刪除標頭但無法刪除標頭規則,這是我的 MWE:
\documentclass[10pt,a4paper]{book}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%to make chapter's first page fancy
\usepackage{fancyhdr}%to add horizental link to header&foofter
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyhead[RE]{\footnotesize\itshape header}
\fancyhead[LO]{\leftmark}
\renewcommand{\footrulewidth}{0.2pt}%the widht of header line
\renewcommand{\headrulewidth}{0.2pt}%the widht of header line
%==========to make chapter title fancy===========
\usepackage{titlesec}
\makeatletter%to make chapter titles fancy
\titleformat{\chapter}[frame]
{\normalfont}{\filright\enspace \@chapapp~\thechapter\enspace}
{20pt}{\Huge\bfseries\filcenter}%20pt the small line that close the box
\titlespacing*{\chapter}
{0pt}{-20pt}{20pt}%{}{between header and box}{space after box}
\makeatother
%====to remove the header====
\fancypagestyle{nofooter}{%
\fancyfoot{}%
}
\fancypagestyle{noheader}{%
\fancyhead{}%
}
\usepackage{lipsum}
\begin{document}
\chapter{Head rule}
\thispagestyle{noheader}%
\lipsum[1]
\section{Head rule}
\lipsum[1]
\end{document}
答案1
你可以透過 make width=0 來做到這一點
\renewcommand{\headrulewidth}{0.0pt}
答案2
我設法透過在這個答案的幫助下嘗試和自訂普通頁面樣式來解決這個問題關聯
\documentclass[10pt,a4paper]{book}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{etoolbox}
%\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%to make chapter's first page fancy
\usepackage{fancyhdr}%to add horizental link to header&foofter
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyhead[RE]{\footnotesize\itshape header}
\fancyhead[LO]{\leftmark}
\renewcommand{\footrulewidth}{0.2pt}%the widht of header line
\renewcommand{\headrulewidth}{0.2pt}%the widht of header line
%==========to make chapter title fancy===========%
\usepackage{titlesec}
\makeatletter%to make chapter titles fancy
\titleformat{\chapter}[frame]
{\normalfont}{\filright\enspace \@chapapp~\thechapter\enspace}
{20pt}{\Huge\bfseries\filcenter}%20pt the small line that close the box
\titlespacing*{\chapter}
{0pt}{-20pt}{20pt}%{}{between header and box}{space after box}
\makeatother
%==========Custmizing plain page style==========%
\fancypagestyle{plain}{
\fancyhf{} %Clear Everything.
\fancyfoot[L]{\thepage} %Page Number
\renewcommand{\headrule}{\hrule height 0pt \vspace{0mm}\hrule height 0pt}
\renewcommand{\footrulewidth}{1pt}
\fancyfoot[C]{}
\fancyfoot[R]{}
\fancyhead[LE]{}
\fancyhead[RO]{}
}
%%%%%%
%====to remove the header====
\fancypagestyle{nofooter}{%
\fancyfoot{}%
}
\fancypagestyle{noheader}{%
\fancyhead{}%
}
\usepackage{lipsum}
\begin{document}
\chapter{Head rule}
%\thispagestyle{noheader}%
\lipsum[1]
\section{Head rule}
\lipsum[1]
\end{document}
就我而言,我使用不同的奇數頁和偶數頁,因此不要忘記根據前後頁面手動移動頁碼。