I was trying to personalize the chapter and section headings using titlesec for my master thesis using the following code

\documentclass{book}
\usepackage{tikz}
\usepackage{titlesec}
\usepackage{lipsum}

\makeatletter
\titleformat{\chapter}[display]
{}% format
{\raggedleft \@chapapp{} \thechapter}% label
{1ex}           % sep
{\raggedleft \Huge \scshape \bfseries}  % before
\makeatother

\begin{document}
\chapter{Introduction}
\lipsum[1]
\end{document}


Which gives the following output

What I want is simply to remove the space between the chapter name and the TikZ drawing and define the vertical space between the drawing and the text (the only one I can get to work is between the chapter and the chapter name). Also which is best for this, titlesec or define all of this as a class file?

I've also tried the second option with similar problems:

\documentclass{book}
\makeatletter
\usepackage{tikz}
\usepackage{palatino}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\vspace*{10\p@}%
{\parindent \z@ \raggedleft \reset@font%
\@chapapp{} \thechapter\par\nobreak%
{\Huge \scshape \bfseries #1\par\nobreak%
\vspace{5pt}
\vspace{40pt}
}}%
\begin{document}
\chapter{Introduction}
\chapter{Internal Structure}
\section{Internal Strut}
%\section{part 1}
\end{document}

-
The vertical space is I think just the line height of \Huge. Maybe not the most elegant solution, but you can simply add negative \vspaces: [\vspace{-0.8em}\normalfont {\tikz \shade[left color=blue!20,right color=blue, shading angle=45] (0,0) rectangle (\textwidth,5pt);}\vspace{-1.5em}] –  Caramdir Jun 26 '12 at 15:40

Insert the line directly in the vertical list:

\makeatletter
\vspace*{10\p@}%
{\parindent \z@ \raggedleft \reset@font
\@chapapp{} \thechapter\par\nobreak