2

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?

  • @marmot I have edited my question using lists. Hope you understand the question better. Thank you very much for your feedback! – JouleV Nov 20 '18 at 5:21
  • May be you are interested in this blog article series about a complete book design. It's based in memoir but will give you an idea about the process. See: latex-my.blogspot.com/search/label/bookdesign – Ignasi Nov 20 '18 at 10:40
  • @Ignasi Sadly your link is not available for me. Google Chrome said latex-my.blogspot.com’s server IP address could not be found. :( – JouleV Nov 20 '18 at 10:41
  • Try with this one. It provides a template with all code and makes reference to original posts: liantze.penguinattack.org/latextypesetting.html#bookdesign – Ignasi Nov 20 '18 at 10:47
2

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}
  • (+1) Thank you very much! Though I don't like the \part{} in its own page, but I can deal with it by myself. One last question: The ToC became Chapter 0: Contents but I want to have Contents only. How can I do? Also, it might be better if I can choose what picture I show on each part/chapter, but it is not really necessary. – JouleV Nov 20 '18 at 6:55
  • 1
    @DũngVũ Sorry for the later reply, I was hibernating. I do not get your result. Rather, when saying \tableofcontents, I get Contents I Introduction 3 II Morestuff 7. Did you compile twice? (And aren't the empty pages just a property of \part in this class? – marmot Nov 20 '18 at 16:00
  • Ah, I'm sorry that I forgot one thing -- the fact is that I also set the same format for \chapter, so it is easy to understand why the output is Chapter 0. – JouleV Nov 20 '18 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.