4

I wanted to make my chapter and ((sub)sub)section titles as follows (compiling by XeTeX-ing):

  • White chapter title on background RGB 10,30,96 (defined as "ugentblauw")
  • (Sub(sub))section title RGB 10,30,96

But I have no clue how to do this... Here's the full code of my file:

\documentclass[11pt]{report}
\usepackage[left=1.5in,right=1.5cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{url}
\newlength\longest
\usepackage[draft]{pdfpages}
\usepackage{xcolor}
\usepackage{sectsty}                
\usepackage{fancyhdr}
\usepackage{tocloft}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
\usepackage{ragged2e}
\usepackage{cite}
\usepackage[T1]{fontenc}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[scaled=0.92]{helvet}    
\usepackage[parfill]{parskip}
\usepackage[square,sort,comma,numbers,sort&compress]{natbib}
\usepackage[nottoc]{tocbibind}
\bibliographystyle{vancouver}
\usepackage{multicol}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{tikz}\usetikzlibrary{shapes.misc}
\usepackage{xunicode}
\usepackage{slantsc}
\usepackage{amsmath}  
\definecolor{ugentblauw}{rgb}{10,30,96}  
\titleformat{\chapter}{\bf\huge}{\thechapter}{20pt}{\bf\huge}
\begin{document}
\normalfont\normalfont
\setcounter{page}{1}
\pagenumbering{arabic}
\chapter{Chapter}
This is some text.
\section{Section}
Indeed, text it is.
\bibliography{bibinflu}
\end{document}

Thank you in advance!

1 Answer 1

6

Is that what you want? I used the framed package, which cooperates with titlesec, and removed sectsty, which conflicts with titlesec. I also removed a few other packages, which were unused in this code fragment.

\documentclass[11pt, x11names, xetex]{report}
\usepackage[left=1.5in,right=1.5cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{framed}

\usepackage{xcolor}
\usepackage{ragged2e}
\usepackage[T1]{fontenc}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[scaled=0.92]{helvet}

\usepackage[parfill]{parskip}
\usepackage[explicit]{titlesec}
\usepackage{xunicode}
\usepackage{xespotcolor} 
\usepackage{framed}
\definecolor{ugentblauw}{cmyk}{1 0.8 0.3 0.05}%
\colorlet{shadecolor}{ugentblauw}

\titleformat{\chapter}[display]{\normalfont\color{white} \begin {shaded*}\bfseries}{\huge\chaptername~\thechapter}{20pt}{\Huge#1\end{shaded*}}

\titleformat{\section}{\normalfont\large\bfseries\color{ugentblauw}}{\thesection}{1em}{#1}

\begin{document}
\setcounter{page}{1}
\pagenumbering{arabic}

\tableofcontents 

\chapter{Chapter}
This is some text.

\section{Section}
Indeed, text it is.
\bibliography{bibinflu}

\end{document} 

enter image description here

enter image description here

7
  • Helped me enormously. Changed the rgb to cmyk 1.0,0.8,0.3,0.05 because that looks more like the blue in pantone 534, though. One more thing: using this won't do anything to my ToC chapter title. How can I change this?
    – FSJ963
    Mar 28, 2015 at 9:52
  • No, it won't change intendedly. I suggest using titletoc, one of the titlesec family, for that. Could you explain what you want for the table of contents?r
    – Bernard
    Mar 28, 2015 at 10:00
  • 1
    The same. (Filling text here so I have enough characters)
    – FSJ963
    Mar 28, 2015 at 10:00
  • \renewcommand{\cfttoctitlefont}{\color{ugentblauw}\bfseries\Huge} will make the title itself blue; so there must be a way to make the shade blue and the title itself white, no?
    – FSJ963
    Mar 28, 2015 at 10:29
  • Fixed by removing all tocloft package entries.
    – FSJ963
    Mar 28, 2015 at 10:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .