4

What I have

I am designing the format of the parts and chapters in my document using TikZ picture, with remember picture, overlay option, like this:

enter image description here

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{lipsum}
\usepackage{color,xcolor}
\usepackage{graphicx}
\definecolor{bggray}{RGB}{215,215,215}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
    \node[below right=4.8cm and 0cm of current page.north east] (a) {};
    \fill[bggray] (current page.north west) rectangle (a);
    \node[below right=1cm and 2cm of current page.north west,color=blue!90] {\huge\bfseries Part I};
    \node[below right=2.5cm and 2cm of current page.north west,color=blue]{\fontsize{30pt}{30pt}\selectfont\scshape Foundations};
    \node[below left=1cm and 3cm of current page.north east] (pic1) {\includegraphics[width=3cm]{0.png}};
\end{tikzpicture}
\end{document}

What I want

Now I have some problems:

  1. Overall customization I want to use this design for all parts and chapters (actually in chapters I will change a bit in colors and sizes). This should satisfy

    • The commands to use the design, like \part{} and \chapter{} in normal design, should be used simply. I prefer something like

      \mypart{Foundations}{abc.jpg}
      \mychapter{Foundations}{abc.jpg}
      
    • The parts and chapters should be numbered as usual.

    • There should be contents referring to the parts/chapter in the Table of Contents, and if I use hyperref package, the ToC contents should be clickable.

  2. The Table of Contents, Bibliography, Index, etc. should be of the same design. In other word, I want

    \tableofcontents
    

    to be as

    \mychapter*{Table of Contents}{} % There will be no pictures included
    

    and to output the result

    enter image description here

    by using \tableofcontents only.


Some remarks

I have read this question: Problem using a tikzpicture in \titleformat, but that is not what I mean, because the question is about normal TikZ picture in title design, but not about remember picture, overlay TikZ picture in title design.

You can either help me to solve my problem, or edit the accepted answer in the attached question so that it suits the requirements well.

All your helps will be highly appreciated!

Thank you in advance!


Edit 2

Following @marmot's answer, and the answer actually almost help me solve the issue. However, the ToC became

Chapter 0
CONTENTS

How to delete Chapter 0?

2

1 Answer 1

3

Here is an attempt. As for instance explained in this answer, by loading the titlesec package with the explicit key, you can make the title part of a tikzpicture, which can of course be an overlay.

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[explicit]{titlesec}
\usepackage{tikz}


\titleformat{\part}
{}
{}
{0em}
{\begin{tikzpicture}[remember picture, overlay]
    \node[below right=4.8cm and 0cm of current page.north east] (a) {};
    \fill[bggray] (current page.north west) rectangle (a);
    \node[below right=1cm and 2cm of current page.north west,color=blue!90]
    {\huge\bfseries Part \thepart};
    \node[below right=2.5cm and 2cm of current page.north
    west,color=blue]{\fontsize{30pt}{30pt}\selectfont\scshape #1};
    \node[below left=1cm and 3cm of current page.north east] (pic1)
    {\includegraphics[width=3cm]{example-image-duck}}; 
\end{tikzpicture}}

\definecolor{bggray}{RGB}{215,215,215}
\begin{document}
\part{Introduction}

Some text

\part{More stuff}
\end{document}
0

You must log in to answer this question.