I want to put a TikZ figure with a fading effect (which I reproduced in the body of the document as illustration) in the page header, which I set with the package titlesec. The following MWE seems to indicate that it doesn't work. Any workaround?
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage[pagestyles]{titlesec}
\newpagestyle{teststyle}{
\renewcommand{\makeheadrule}{%
\color{blue}%
\rule[-.3\baselineskip]{\linewidth}{1pt}}
%% HEADER - depends on option
\sethead{}%
{}%
{%
\FadingSection
}%
}
\newcommand{\FadingSection}{%
\begin{tikzpicture}[baseline=(mabox.base)]
\node[rectangle,baseline=current bounding box.base,anchor=south east,inner ysep =0cm,inner xsep =0cm](mabox) at (0,0) {\sectiontitle};
\fill[path fading=west,fill=white] (-5,0) rectangle (0,1em);
\end{tikzpicture}
}
\begin{document}
\pagestyle{teststyle}
\section{ ABCD EFGH IJKLM NOPQR 1111 2222 3333 4444}
\FadingSection
\end{document}