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 am writing a project in latex and to make my output pdf look more fancy i am using a "Fancy chapter headings with TikZ" code found here http://texblog.net/latex-archive/layout/fancy-chapter-tikz/ (thx to author). But the thing is I don't want to just use it, I also want to understand it. I have never used titlesec package before so that's why i need your help. Can you give some short explanation to every line or at least answer some additional questions i have put in comments?Those are more imporatnt :) I will really appreciate your help and effort.

THANK YOU

Here's the code from that page:

\documentclass[svgnames]{report}
\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}

%EXPLANATION FROM HERE
\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) % why is here used 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}; %why is here used argument by \chapterlabel?
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

%TO HERE

\begin{document}
\tableofcontents
\chapter{Introduction}
Text
\chapter{Main}
\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference
\end{thebibliography}
\end{document}
share|improve this question

closed as not a real question by Marco Daniel, lockstep, egreg, Joseph Wright Jun 3 '12 at 12:59

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Did you red the titlesec manual (e.g. via texdoc titlesec in your terminal / command line)? It should tell you more about the right usage. I think it’s not sense of this site to rephrase manuals ;-) –  Tobi Apr 24 '12 at 10:18
    
@KvJohn: You can find a nice explanation of \newcommand* if you search for newcommand star on this site. –  Jake Apr 24 '12 at 10:42
    
@Jake - thx for the \newcommand* @ Tobi i am not asking for a complete explanation from manuals just short one for quick understanding cuz i really have no time to study manuals. But thank you anyway ;) –  KvJohn Apr 24 '12 at 12:23
    
The LaTeX command \newcommand* acts like the TeX-primitive command \def, whereas the LaTeX command \newcommand (without the star) acts like \long\def. A "long" definition of a macro allows for paragraph breaks inside the macro's argument(s), whereas a non-long definition does not. This distinction is useful if you know that a macro's argument(s) should never contain paragraph breaks: by making the macro non-long, LaTeX/TeX will automatically trigger an error message if it does encounter a paragraph break, as this break is (likely) caused by omitted brace somewhere in the code. –  Mico Apr 24 '12 at 12:27
    
Thank you very much. And can you pls tell me how is this last argument by \chapterlabel used?What preferences is this arg. calling? –  KvJohn May 7 '12 at 8:39

Browse other questions tagged or ask your own question.