1

I'm trying to put a full-width background-image under my chapter titles. So far I figured out how to achieve this, but the chapter number now appears under the background image instead of on top of it.

This is my code:

\usepackage{tikz}
\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\bfseries\Large\raggedleft\color{black}}
  {\MakeUppercase{\chaptertitlename}%
    \rlap{ \resizebox{!}{1.5cm}{\thechapter}}
    {\noindent\makebox[\textwidth]{\tikz[remember picture,overlay] \node[opacity=0.9,inner sep=0pt] at (current page.south west){\includegraphics[width=1.1\paperwidth]{test}};}}    
  }
  {10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-70pt}{180pt}

As you can see the chapter number is greyed out because of the opacity of the image:

enter image description here

Can anyone help me with this issue?

4

1 Answer 1

1

Your problem is, that the image is inserted after chapter name and number, thus overdrawing them. By just putting it first, this can be solved.

I also took the freedom to adjust the anchors (they were wrong) and remove the unnecessary \makebox (\tikz[...,overlay,...] doesn't take up any space).

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

\titleformat{\chapter}[display]
  {\normalfont\bfseries\Large\raggedleft\color{black}}
  {\tikz[remember picture,overlay] \node[opacity=0.9,inner sep=0pt,anchor=north] at (current page.north){\includegraphics[width=\paperwidth,height=10cm]{example-image-a}};
    \MakeUppercase{\chaptertitlename}%
        \rlap{ \resizebox{!}{1.5cm}{\thechapter}}
  }
  {10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-70pt}{180pt}

\begin{document}
\chapter{Some chapter title}
\section{Some section title}
Some Text
\end{document}
0

You must log in to answer this question.

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