删除每个编号/未编号章节第一页上的标题规则

删除每个编号/未编号章节第一页上的标题规则

我无法删除每个编号或未编号章节第一页上的标题规则。我该如何解决这个问题?以下是我的 MWE:

\documentclass[11pt,openany,twoside]{book}
\raggedbottom
\let\cleardoublepage=\clearpage
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage[dotinlabels]{titletoc}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline}
\pagestyle{fancy} 
\fancyhf{}
\fancyhead[OL]{\myheaderfooterfont\leftmark}
\fancyhead[ER]{\myheaderfooterfont\rightmark}
\fancyfoot{}
\fancyfoot[R]{\myheaderfooterfont\thepage}
\renewcommand\headrule
{{     \color{blue}\rule{0.33\headwidth}{2.5pt}%   <---
        \color{blue}\rule{0.34\headwidth}{2.5pt}%    <---
        \color{blue}\rule{0.33\headwidth}{2.5pt}% <---
        
}}
\usepackage[noindentafter,calcwidth]{titlesec}
\usepackage{helvet}
\titleformat{\section}
{\normalfont\Large\bfseries\color{black}}
{\thesection}{1em}{}

\titleformat{\subsection}
{\normalfont\large\bfseries\color{black}}
{\thesubsection}{1em}{}

\usepackage{calc}

\fancypagestyle{plain}{%
    \fancyhf{}%
    %
    \fancyhead{}%
    \renewcommand\headrule
    {{     \color{blue}\rule{0.33\headwidth}{2.5pt}%   <---
            \color{red}\rule{0.34\headwidth}{2.5pt}%    <---
            \color{orange}\rule{0.33\headwidth}{2.5pt}% <---
            
    }}  
    
    
    \fancyfoot{}
    \fancyfoot[R]{\myheaderfooterfont\thepage}

    
}
\usepackage{multirow}
\newcommand*\myheaderfooterfont{\normalfont\bfseries}
\usepackage[nottoc]{tocbibind}
\usepackage[ragged]{sidecap}
\usepackage[marginal]{footmisc}
\renewcommand\footnoterule{\vspace*{-3pt}%
    \hrule width 2in height 1.4pt \vspace*{2.6pt}}
\setlength\footnotemargin{10pt}

\usepackage{regexpatch}
\usepackage{float}

\begin{document} 
    \frontmatter


        \tableofcontents
        \listoffigures
        \listoftables

    
    \chapter*{BFGG}
    \chapter*{TTEG}
    
    \mainmatter
    \setcounter{tocdepth}{1}
    \chapter{DGGRTF}
    \chapter{VGDGDG}
\end{document}

答案1

试试这个代码。查看 fancy 和 plain 样式的定义。后者适用于本章的第一页。

A

\documentclass[11pt,openany,twoside]{book}
\raggedbottom
\let\cleardoublepage=\clearpage
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage[dotinlabels]{titletoc}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline}

%%*********************************** changed  <<<<<<<<<<<<<<<<<<<<<<<<<<
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[OL]{\myheaderfooterfont\leftmark}
\fancyhead[ER]{\myheaderfooterfont\rightmark}
\fancyfoot[R]{\myheaderfooterfont\thepage}  
\renewcommand{\headrule}{{\color{blue}\rule{0.33\headwidth}{2.5pt}\color{red}\rule{0.34\headwidth}{2.5pt}\color{orange}\rule{0.33\headwidth}{2.5pt}}}
}

\fancypagestyle{plain}{%
    \fancyhf{}%
    \renewcommand{\headrulewidth}{0pt}
    \fancyfoot[R]{\myheaderfooterfont\thepage}
    \renewcommand{\headrule}{}
}

\pagestyle{fancy} 

\usepackage{kantlipsum}% only for dummy text
%%************************************************

\usepackage[noindentafter,calcwidth]{titlesec}
\usepackage{helvet}
\titleformat{\section}
{\normalfont\Large\bfseries\color{black}}
{\thesection}{1em}{}

\titleformat{\subsection}
{\normalfont\large\bfseries\color{black}}
{\thesubsection}{1em}{}

\usepackage{calc}


\usepackage{multirow}
\newcommand*\myheaderfooterfont{\normalfont\bfseries}
\usepackage[nottoc]{tocbibind}
\usepackage[ragged]{sidecap}
\usepackage[marginal]{footmisc}
\renewcommand\footnoterule{\vspace*{-3pt}%
    \hrule width 2in height 1.4pt \vspace*{2.6pt}}
\setlength\footnotemargin{10pt}

\usepackage{regexpatch}
\usepackage{float}



\begin{document} 
    \frontmatter    
    
    \tableofcontents
    \listoffigures
    \listoftables   
    
    \chapter*{BFGG}
    
    \kant[1-6]
    \chapter*{TTEG}
        \kant[1-6]
    \mainmatter
    \setcounter{tocdepth}{1}
    \chapter{DGGRTF}
        \kant[1-5]
    \chapter{VGDGDG}    
        \kant[1-5]
\end{document}

相关内容