In general, I would like to have my sections in the same two-colored, fading style. I already found the TikZ and the \fadingtext command, which works very well whilst using "LaTeX" or "PDFlatex" for compiling.
Unfortunately, I need to use "XeLaTeX" for my document and I have the problem, that the name just duplicates. I also tried this minimal example and I have the same problem with the sentences. They're colored, but the sentences are just a copy of the first section name. For my sections I just need one fading color (from green to gray) and I also don't have numbered sections, the different colors in this example are just for better understanding.
%!TEX TS-program = xelatex
\documentclass[border=10pt,varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings}
\tikzset{fading text/.style={}}
\newcommand\fadingtext[2][]{%
\begin{tikzfadingfrompicture}[name = fading letter]
\node[text = transparent!0, inner xsep = 0pt, outer xsep = 0pt] {#2};
\end{tikzfadingfrompicture}%
\begin{tikzpicture}[baseline = (textnode.base)]
\node[inner sep = 0pt, outer sep = 0pt] (textnode) {\phantom{#2}};
\shade[path fading = fading letter, fading text, #1, fit fading = false]
(textnode.south west) rectangle (textnode.north east);%
\end{tikzpicture}%
}
\begin{document}
\tikzset{fading text/.style = {left color = red, right color = green}}
\section{\fadingtext[left color = orange, right color = green]{Important}}
For testing the alignment:
\fadingtext[left color = red, right color = blue]{Here is a colored sample sentence.}
And
\fadingtext[left color = orange, right color = green]{This is another colored sentence.}
\section{\fadingtext[left color = red, right color = blue]{Very Important}}
\end{document}
Thank you for your help :)
