[Tex/LaTex] fancy heading … \section{} titles disappears

sectioningtitlesec

By combining the next two questions-answers Fancy chapter headings and Section title gradient
. I have this effect.

The problem is that the name of \section{} disappears. What is wrong?

enter image description here

\documentclass[b5paper,svgnames,10pt]{book}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage[margin=1.5cm]{geometry}
\usepackage{lipsum}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\usepackage[cm-default]{fontspec}
\setromanfont{FreeSerif}
\setsansfont{FreeSans}
\setmonofont{FreeMono}
\usepackage{xgreek}
\setmainfont{Arial}

%%%%%%%%%%%%%%%%%%%% fancy heading  \section %%%%%%%%%%%%%%%%%%%%%%

\titleformat{\section}[block]%              
    {\huge\bfseries%
     \tikz[overlay] \shade[left color=LightSkyBlue,right color=white,] (0,-1ex) rectangle (\textwidth,1em);}%    
    {\thesection}%                   
    {1em}%
    {}

%%%%%%%%%%%%%%%%%% fancy heading  \chapter %%%%%%%%%%%%%%%%%%%%%%%%

\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
  \normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
    {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=LightSkyBlue] (0,0) rectangle
        (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
        rounded corners=20pt,inner sep=11pt,
        fill=MidnightBlue]
        {\color{white}\chapterlabel#1};
      \end{tikzpicture}
    };
  \end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\part{Ενέργεια}

\chapter{Κινητική}

\section{Κινήσεις}
\lipsum[1]

\section{Δυναμική}
\lipsum[1]

\end{document}

Best Answer

With the package option explicit of titlesec, the title has to be given explicitly in the format definition, like:

\titleformat{\section}[block]%              
    {\huge\bfseries%
     \tikz[overlay] \shade[left color=LightSkyBlue,right color=white,] (0,-1ex) rectangle (\textwidth,1em);}%    
    {\thesection}%                   
    {1em}%
    {#1}

The right place for it is usually the last mandatory argument of \titleformat, the before-code. The argument #1 expands to the title.