I want to put a color gradient to a "Desired Text Only" but then I want to be able to position it inside a tikzpicure. I already checked this thread describing a way to put gradient color to a section heading.
Problem is: I am unable to freely place such a node inside a tikzpicureenvironment.
Here is a MWE of what I tried:
\documentclass[12pt,a5paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{fadings,patterns}
%******************************************************************
%
% Defining a new coordinate system for the page:
%
% --------------------------
% |(-1,1) (0,1) (1,1)|
% | |
% |(-1,0) (0,0) (1,0)|
% | |
% |(-1,-1) (0,-1) (1,-1)|
% --------------------------
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
\parsecomma#1\endparsecomma
\pgfpointanchor{current page}{north east}
% Save the upper right corner
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
% save the lower left corner
\pgfpointanchor{current page}{south west}
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
% Transform to the correct placement
\pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
\expandafter\pgf@x\expandafter=\pgfmathresult pt
\pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
\expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother
%******************************************************************
\begin{document}
\begin{tikzfadingfrompicture}[name=tikz]
\node [text=transparent!20] {\bfseries Piece of text to be colored};
\end{tikzfadingfrompicture}
\begin{tikzpicture}[remember picture, overlay]
\node [text=gray!50,inner sep=0pt,outer sep=0pt] (textnode)%
{\bfseries Piece of text to be colored};
\shade[path fading=tikz,fit fading=false,left color=blue,right color=black]%
(textnode.south west) rectangle (textnode.north east);
\end{tikzpicture}
\end{document}
Such code succeeded in putting a color gradient into my piece of text.

But then, when I try to place the latter somewhere inside the tikzpicture environment adding a position to the node such as:
\node [text=gray!50,inner sep=0pt,outer sep=0pt] (textnode) at (page cs:0,0)
{\bfseries Piece of text to be colored};
it seems that only the piece of text moves and not the color gradient and I obtain this :

What am I doing wrong? How can I freely place such color gradient piece of text inside a tikzpicture?
