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.

Here is a MWE of the code I am using for applying a titleformat to my chapters. But it does not get applied to my bibliography chapter. Any ideas why?

\documentclass[a4paper,11pt]{report}

\usepackage{times}
\usepackage{makeidx}

\usepackage{tikz}
\usetikzlibrary{calc}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\usepackage{titlesec}

\titleformat{\chapter}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\huge\color{blue!50!black}\textbf{\thechapter}~~};
  \begin{tikzpicture}[remember picture,overlay]
    \coordinate (leftborder) at ($(nr)-(100,0)$);
    \coordinate (leftborderhigh) at ($(nr.north west)-(100,0)$);
    \coordinate (leftborderlow) at ($(nr.south west)-(100,0)$);
    \coordinate (left) at ($(nr.west)-(1.5,0)$);
    \path[shade, top color=blue!1,bottom color=blue!20] (leftborderhigh) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder) -- cycle;
    \path[shade, top color=blue!20,bottom color=blue!1] (leftborderlow) -- ($(nr.south west)-(0,0.5)$) -- (left) -- (leftborder) -- cycle;
    \draw[blue!50!black,line width=0.1em,line join=round] (left) -- ($(nr.south west)-(0,0.5)$) -- ($(nr.south east)-(0,0.5)$) -- ($(nr.north east)+(0,0.5)$) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder);
  \end{tikzpicture}}
{5ex}
{\filleft\LARGE\bf}
[\vspace{0ex}]

\makeindex

\begin{document}
\chapter{Introduction}
\chapter{Chapter about XXX}
\chapter{Chapter about YYY}
\chapter{Conclusion}
\bibliography{../references}
\end{document}
share|improve this question
    
The bibliography is set as \chapter*, not \chapter. –  Werner May 25 '12 at 16:17
    
Do you want that the bibliography is numbered? –  egreg May 25 '12 at 16:18
add comment

1 Answer

In case you don't want a numbered bibliography, you need to add separate customization code using \titleformat{name=\chapter,numberless}. Add the following to your preamble (I used \phantom to preserve the size of your TikZ decoration):

\titleformat{name=\chapter,numberless}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\huge\color{blue!50!black}\phantom{\textbf{\thechapter}}~~};
  \begin{tikzpicture}[remember picture,overlay]
    \coordinate (leftborder) at ($(nr)-(100,0)$);
    \coordinate (leftborderhigh) at ($(nr.north west)-(100,0)$);
    \coordinate (leftborderlow) at ($(nr.south west)-(100,0)$);
    \coordinate (left) at ($(nr.west)-(1.5,0)$);
    \path[shade, top color=blue!1,bottom color=blue!20] (leftborderhigh) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder) -- cycle;
    \path[shade, top color=blue!20,bottom color=blue!1] (leftborderlow) -- ($(nr.south west)-(0,0.5)$) -- (left) -- (leftborder) -- cycle;
    \draw[blue!50!black,line width=0.1em,line join=round] (left) -- ($(nr.south west)-(0,0.5)$) -- ($(nr.south east)-(0,0.5)$) -- ($(nr.north east)+(0,0.5)$) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder);
  \end{tikzpicture}}
{5ex}
{\filleft\LARGE\bf}
[\vspace{0ex}]
share|improve this answer
    
Thank you very much, perfect. Now my tikz decoration looks empty but that has nothing to do with the problem. –  Saki May 26 '12 at 7:09
    
@Saki You may also thank me by upvoting and accepting my answer. :-) –  lockstep May 26 '12 at 7:10
add comment

Your Answer

 
discard

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.