1

The following code is based on: Fancy header and footers

I would like to remove the section number in the header but keep it in the main text. I have tried but without succes:

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

enter image description here

\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

This is as simple as adding

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

to your preamble.

enter image description here

By default, \sectionmark - the macro responsible for setting the mark associated with \section - resembles this:

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

I've just removed the conditional setting of \thesection (and space).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.