Help replicating this Document Design
With tikzpagenodes
you can adjust things to the width of the actual page. It has the node current page text area
, which is a rectangle that covers the text area.
\documentclass[twoside]{scrbook}
\usepackage[letterpaper, left=1.5cm, right=1.5cm, bindingoffset=1.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}
\definecolor{gmitblue}{RGB}{93,138,168}
\definecolor{midnightgreen}{rgb}{0.0, 0.29, 0.33}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CO]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north west)+(0.25in,-0.35in)$) rectangle ($(current page.north west)+(0.65in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text
height=0.2in,inner xsep=1em] at (TL) {\rightmark};
\end{tikzpicture}%
}
\fancyhead[CE]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north east)+(-0.65in,-0.35in)$) rectangle ($(current page.north east)+(-0.25in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text height=0.2in,inner xsep=1em]
at (TL) {\leftmark};
\end{tikzpicture}%
}
\setlength{\headheight}{12pt}
\title{A reasonably long title}
\date{\today}
\author{The author}
\begin{document}
\maketitle
\chapter[Hola Mundo]{Hola Mundo}
\lipsum[1-9]
\section{La prueba na' ma'}
\chapter[Hola de Nuevo]{Hola Mundo\dots\space de Nuevo}
\lipsum[10-29]
\end{document}
Based on the code of @marmot, I added some missing parts. Please see the MWE later.
To recreate the shown structure of a document you need to add some code to your given MWE:
Add
\usepackage{multicol}
in your preamble and then add the following code to get a TOC in two columns:\begin{multicols}{2} % <================================================ \tableofcontents % <==================================================== \end{multicols} % <=====================================================
- I added
\maketitle
to your code to get the title of the document. To be able to add easily an complete dummy document I changed
\usepackage{lipsum}
to\usepackage{blindtext} % <========================== \Blinddocument
Remember to change
\lipsum...
to\blindtext
...To get your wanted header on chapter pages etc., too, you have to define
\fancypagestyle{plain}{% <==============================================
(see the full code in the following MWE).
- Please see that I added at the end of your text
\Blinddocument
to get a better filled TOC for showing the two column TOC. - Have you noticed the warnings you got because you are using a KOMA-Script class with
fancyhdr
andtitlesec
? KOMA-Script has an own way to build headers with packagescrlayer-scrpage
(please see documentation withtexdoc KOMA-Script
on your terminal/console). You should consider to change to that package but that was not the question here (If you can not do it by your own, ask a new question and show what you have tried so far ...).
The complete corrected MWE:
\documentclass[twoside,letterpaper]{scrbook}
\usepackage[letterpaper, left=1.5cm, right=1.5cm, bindingoffset=1.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr} % <=========================== better use scrlayer-scrpage
\usepackage{titlesec} % <=========================== see warnings in log file
\usepackage{multicol} % <===============================================
%\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{blindtext} % <========================== \Blinddocument
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}
\definecolor{gmitblue}{RGB}{93,138,168}
\definecolor{midnightgreen}{rgb}{0.0, 0.29, 0.33}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CO]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north west)+(0.25in,-0.35in)$) rectangle ($(current page.north west)+(0.65in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text
height=0.2in,inner xsep=1em] at (TL) {\rightmark};
\end{tikzpicture}%
}
\fancyhead[CE]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north east)+(-0.65in,-0.35in)$) rectangle ($(current page.north east)+(-0.25in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text height=0.2in,inner xsep=1em]
at (TL) {\leftmark};
\end{tikzpicture}%
}
\fancypagestyle{plain}{% <==============================================
\fancyhf{}
\fancyhead[CO]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north west)+(0.25in,-0.35in)$) rectangle ($(current page.north west)+(0.65in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text
height=0.2in,inner xsep=1em] at (TL) {\rightmark};
\end{tikzpicture}%
}
\fancyhead[CE]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[midnightgreen] ($(current page.north east)+(-0.65in,-0.35in)$) rectangle ($(current page.north east)+(-0.25in,-0.75in)$)
node[midway,text=white, font=\large\bfseries] {\thepage};
\fill[midnightgreen] ([yshift=-0.35in]current page.north-|current page text area.west)
coordinate (TL)
rectangle ([yshift=-0.75in]current page.north-|current page text area.east);
\node[anchor=north west, text=white, font=\large\bfseries,text height=0.2in,inner xsep=1em]
at (TL) {\leftmark};
\end{tikzpicture}%
}}
\setlength{\headheight}{14pt}
\title{A reasonably long title}
\date{\today}
\author{The author}
\begin{document}
\maketitle % <==========================================================
\begin{multicols}{2} % <================================================
\tableofcontents % <====================================================
\end{multicols} % <=====================================================
\chapter[Hola Mundo]{Hola Mundo}
\blindtext
\section{La prueba na' ma'}
\chapter[Hola de Nuevo]{Hola Mundo... de Nuevo}
\blindtext
\Blinddocument % <======================================================
\end{document}
and its result:
and an usual chapter page: