I want to define a special sectioning type for my CV. But I have problem which I can't figure out myself. I got the following code which produces the section heading with a color gradient how I would like it to be. Using it for the first section is working fine, but for the following sections I get always the same result which was written in the first section. The following code will illustrate the problem:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings,patterns,positioning,fit}
\tikzset{
zero sep/.style = {inner sep=0pt, outer sep=0pt},
}
\begin{document}
\newsavebox{\tempbox}
\newcommand\tikzsection[1]{%
\begin{tikzfadingfrompicture}[name=tikzsection]
\node [minimum width=50mm, minimum height=2.5mm, fill=white, zero sep] (box node) {};
\node (text node) [text=white, right=10pt of box node.east, anchor=west, zero sep] {\normalfont \Large \bfseries #1};
\node [fit=(box node.north west) (text node.south east) (text node.north west) (box node.south east)] {};
\end{tikzfadingfrompicture}
\begin{lrbox}{\tempbox}%
\begin{tikzpicture}
\node [text width=50mm, minimum height=2.5mm, fill=white, zero sep] (boxnode) {};
\node [text=white, right=10pt of boxnode.east, anchor=west, zero sep] (textnode) {\normalfont \Large \bfseries #1};
\node (fitnode) [fit=(boxnode.north west) (textnode.south east) (textnode.north west) (boxnode.south east)] {};
\shade[path fading=tikzsection, fit fading=false,left color=blue, right color=black]
(fitnode.north west) rectangle (fitnode.south east);
\end{tikzpicture}%
\end{lrbox}
% Now we use the fading in another picture:
\section{\usebox\tempbox{}}%
}
\tikzsection{First section}
Some text
\tikzsection{Secoooooond section}
Some text
\tikzsection{Short}
Some text
\end{document}
Can someone figure out for me what is going wrong here? Why is the section titled as "Secoooooond section" rendered as "First section"?
\listfiles
gives me the following list:
- article.cls 2007/10/19 v1.4h Standard LaTeX document class
- size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
- tikz.sty 2013/12/13 v3.0.0 (rcs-revision 1.142)
- pgf.sty 2013/12/18 v3.0.0 (rcs-revision 1.14)
- pgfrcs.sty 2013/12/20 v3.0.0 (rcs-revision 1.28)
- everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
- pgfrcs.code.tex pgfcore.sty 2010/04/11 v3.0.0 (rcs-revision 1.7)
- graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
- keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
- graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
- trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
- graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
- xetex.def 2013/04/29 v0.96 LaTeX color/graphics driver for XeTeX (RRM/JK)
- pgfsys.sty 2013/11/30 v3.0.0(rcs-revision 1.47)
- pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
- pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
- xcolor.sty 2007/01/21 v2.11 LaTeX color extensions
- color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
- pgfcomp-version-0-65.sty 2007/07/03 v3.0.0 (rcs-revision 1.7)
- pgfcomp-version-1-18.sty 2007/07/23 v3.0.0 (rcs-revision 1.1)
- pgffor.sty 2013/12/13 v3.0.0 (rcs-revision 1.25)
\listfiles
just before\begin{document}
and add the package versions to your question so we can determine the package that is responsible. Alternatively, update to TeXLive2014.