删除页眉或页脚中的节号

删除页眉或页脚中的节号

以下代码基于:精美的页眉和页脚

我想删除页眉中的章节编号,但将其保留在正文中。我试过但没有成功:

\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{0pt}{\Large} 

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper, left=1.5cm, right=1.5cm, bindingoffset=1.5cm]{geometry}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}
\usepackage{titlesec}


\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{0pt}{\Large}

\definecolor{gmitblue}{RGB}{93,138,168}

\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{%
\begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-1in)$);
    \node[anchor=north west, text=white, font=\Large, minimum size=1in, inner xsep=5mm] at (current page.north west) {\leftmark};
      %node[minimum width=\x2-\x1, minimum height=2cm, draw, rectangle, fill=blue!20, anchor=north west, align=left, text width=\x2-\x1] at ($(current page.north west)$) {\Large\bfseries \quad #1};
\end{tikzpicture}
}
\fancyfoot[C]{
    \begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
    \node[anchor=south west, text=white, font=\Large, minimum size=.5in] at (current page.south west) {\thepage};
    \node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {};
    \node[anchor=south east, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south east) {\today};
\end{tikzpicture}
}
\fancyfoot[CO]{
    \begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
    \node[anchor=south west, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south west) {\today};
    \node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {};
    \node[anchor=south east, text=white, font=\Large, minimum size=.5in] at (current page.south east) {\thepage};
\end{tikzpicture}
}



\begin{document}
%\chapter{first chapter}
\section{Sectiona A}
\lipsum[1-9]

%\chapter{second chapter}
\newpage
\section{Section B}
\lipsum[10-19]
\end{document}

答案1

这就像添加一样简单

\renewcommand{\sectionmark}[1]{\markboth{\MakeUppercase{#1}}{}}

你的序言。

在此处输入图片描述

默认情况下,\sectionmark负责设置相关标记的宏\section类似于以下内容:

\newcommand{\sectionmark}[1]{%
  \markboth{%
    \MakeUppercase{%
      \ifnum\c@secnumdepth>\z@
        \thesection
        \hskip 1em
      \fi
      #1%
    }%
  }%
}

\thesection我刚刚删除了(和空间)的条件设置。

相关内容