I am using the fancyhdr package to customize my header and would like to display it with the section number, but without the section name, i.e. :
______________________________________________
| Section ## Page #/total |
| |
I am using the following code to custom the header:
\usepackage{fancyhdr}
\fancyhead[C]{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-.05\paperheight] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=MainColor] (0,0) rectangle
(\paperwidth,.05\paperheight);;
\node[anchor=west,xshift=.01\paperwidth,yshift=.025\paperheight,text width=\paperwidth]
{\normalfont\huge\color{white}\quad{Section \leftmark}};
\node[anchor=west,xshift=.92\paperwidth,yshift=.025\paperheight,text width=\paperwidth]
{\normalfont\normalsize\bfseries\textcolor{white}{\thepage/\hypersetup{linkcolor=white}\pageref{LastPage}}};
\end{tikzpicture}
};
\end{tikzpicture}}
Any ideas?
Thanks
EDIT: Added MWE
\documentclass{article}
\usepackage{tikz}
\usepackage{fancyhdr}
% HEADER %
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{
\begin{tikzpicture}[remember picture, overlay]
\draw[fill=blue,xshift=-.5\paperwidth,yshift=-.5cm] (0,0) rectangle
(1.1\paperwidth,1.5cm);;
\node[anchor=north west,xshift=-.5\paperwidth,yshift=.5cm,text width=\paperwidth]
{\normalfont\huge\color{white}\quad{Section. \leftmark}};
\end{tikzpicture}
}
\usepackage{lipsum}
\begin{document}
\section{blah}
\lipsum
\subsection{asdf}
\lipsum \lipsum \lipsum
\section{blahblah}
\lipsum
\lipsum
\end{document}
and it works. :)
\leftmark
with\thesection
Section 5
it printsSection 6
. Any idea why?\renewcommand{\sectionmark}[1]{\markright{\thesection}}