Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was looking to apply a color gradient to some text (i.e. Chapter / section headings) and I searched through the Internet but was unable to find a minimum working example. Is it something that can be done in XeLaTeX?

I decided to ask here, thinking someone in the community might have already done similar to that.

share|improve this question
Have a look at the following thread: http://tex.stackexchange.com/questions/12266/section-title-gradient –  Uwe Ziegenhagen Feb 25 '12 at 23:07
Thats for section background color gradient. I want to do color gradient to text only not the background. –  Aku Feb 26 '12 at 22:43

1 Answer 1

The following example comes from the TikZ 2.10 manual, p237, and seems to do what you describe:

  \node [text=transparent!20]
    {\fontfamily{ptm}\fontsize{45}{45}\bfseries\selectfont Ti\emph{k}Z};
% Now we use the fading in another picture:
  \fill [black!20] (-2,-1) rectangle (2,1);
  \pattern [pattern=checkerboard,pattern color=black!30] (-2,-1) rectangle (2,1);
  \shade[path fading=tikz,fit fading=false, left color=blue,right color=black]
    (-2,-1) rectangle (2,1);

Adapting this somewhat, you can achieve the following:

    \node [text=white] {\normalfont \Large \bfseries #1};
      \node [text=white,inner sep=0pt,outer sep=0pt] (textnode) {\normalfont \Large \bfseries #1};
      \shade[path fading=tikzsection,fit fading=false,left color=blue,right color=black]
      (textnode.south west) rectangle (textnode.north east);
  % Now we use the fading in another picture:
  \section{XX \usebox\tempbox{} XX}%
\tikzsection{First section}
Some text
\tikzsection{Second section}
Some text

which produces

screenshot of faded text

share|improve this answer
It is preferable if you provide a complete compilable example including the \documentclass{article}, and all the packages. And, show how to apply this to a chapter/section heading. –  Peter Grill Feb 27 '12 at 22:49
@PeterGrill, fair point, I've now done so :) –  Ben Lerner Feb 27 '12 at 23:24
Great. Just one more thing: you should probably remove the debugging code \show\section. –  Peter Grill Feb 27 '12 at 23:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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