1

I came across this "Part" page formatting but wanted to implement this using the {scrlayer-scrpage}. How can I accomplish this so that I can get my "Part" page to show up like this:

enter image description here

Here is the original code:

\documentclass{book}
\usepackage{calc}
\usepackage{graphicx, rotating, ltablex, dcolumn, booktabs}
\usepackage{siunitx}
\usepackage[english]{babel}
\usepackage[usenames,dvipsnames,svgnames,table,xcdraw]{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\usepackage{tikz}
\usepackage{colortbl}
\usepackage[version=4]{mhchem}
\usepackage{fixltx2e}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{avant}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%======================================================================================
%   PART HEADINGS
%======================================================================================
\usepackage[explicit,calcwidth]{titlesec}
\usepackage{titletoc} % Required for manipulating the table of contents
\usepackage{fourier}
\usepackage{etoolbox,fancyhdr} % Required for header and footer configuration
\pagestyle{fancy}

% Chapter text styling
\titlecontents{lchapter}[0em] % Indenting
{\addvspace{15pt}\large\sffamily\bfseries} % Spacing and font options for chapters
{\color{mybluei}\contentslabel[\Large\thecontentslabel]{1.25cm}\color{mybluei}} % Chapter number
{}
{\color{mybluei}\normalsize\sffamily\bfseries\;\titlerule*[.5pc]{.}\;\thecontentspage} % Page number

% Section text styling
\titlecontents{lsection}[0em] % Indenting
{\sffamily\small} % Spacing and font options for sections
{\contentslabel[\thecontentslabel]{1.25cm}} % Section number
{}
{}

% Subsection text styling
\titlecontents{lsubsection}[.5em] % Indentation
{\normalfont\footnotesize\sffamily} % Font settings
{}
{}
{}

\makeatletter

% numbered part in the table of contents
\newcommand{\@mypartnumtocformat}[2]{%
\setlength\fboxsep{0pt}%
\noindent\colorbox{mybluei!20}{\strut\parbox[c][.7cm]{\ecart}{\color{mybluei!70}\Large\sffamily\bfseries\centering#1}}\hskip\esp\colorbox{mybluei!40}{\strut\parbox[c][.7cm]{\linewidth-\ecart-\esp}{\Large\sffamily\centering#2}}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% unnumbered part in the table of contents
\newcommand{\@myparttocformat}[1]{%
\setlength\fboxsep{0pt}%
\noindent\colorbox{mybluei!40}{\strut\parbox[c][.7cm]{\linewidth}{\Large\sffamily\centering#1}}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\esp
\setlength\esp{4pt}
\newlength\ecart
\setlength\ecart{1.2cm-\esp}
\newcommand{\thepartimage}{}%
\newcommand{\partimage}[1]{\renewcommand{\thepartimage}{#1}}%
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax%
\refstepcounter{part}%
\addcontentsline{toc}{part}{\texorpdfstring{\protect\@mypartnumtocformat{\thepart}{#1}}{\partname~\thepart\ ---\ #1}}
\else%
\addcontentsline{toc}{part}{\texorpdfstring{\protect\@myparttocformat{#1}}{#1}}%
\fi%
\startcontents%
\markboth{}{}%
{\thispagestyle{empty}%
\begin{tikzpicture}[remember picture,overlay]%
\node at (current page.north west){\begin{tikzpicture}[remember picture,overlay]%   
\fill[mybluei!20](0cm,0cm) rectangle (\paperwidth,-\paperheight);
\node[anchor=north] at (4cm,-3.25cm){\color{mybluei!40}\fontsize{220}{100}\sffamily\bfseries\@Roman\c@part};
\node[anchor=south east] at (\paperwidth-1cm,-\paperheight+1cm){%
\parbox[t][][t]{\textwidth}{%
\columnsep=50pt
\begin{multicols}{2}
\printcontents{l}{0}{\setcounter{tocdepth}{1}}%
\end{multicols}}};
\node[anchor=north east] at (\paperwidth-1.5cm,-3.25cm){\parbox[t][][t]{15cm}{\strut\raggedleft\color{white}\fontsize{30}{30}\sffamily\bfseries#2}};
\end{tikzpicture}};
\end{tikzpicture}}%
\@endpart}
\def\@spart#1{%
\startcontents%
\phantomsection
{\thispagestyle{empty}%
\begin{tikzpicture}[remember picture,overlay]%
\node at (current page.north west){\begin{tikzpicture}[remember picture,overlay]%   
\fill[mybluei!20](0cm,0cm) rectangle (\paperwidth,-\paperheight);
\node[anchor=north east] at (\paperwidth-1.5cm,-3.25cm){\parbox[t][][t]{15cm}{\strut\raggedleft\color{white}\fontsize{30}{30}\sffamily\bfseries#1}};
\end{tikzpicture}};
\end{tikzpicture}}
\addcontentsline{toc}{part}{\texorpdfstring{%
\setlength\fboxsep{0pt}%
\noindent\protect\colorbox{mybluei!40}{\strut\protect\parbox[c][.7cm]{\linewidth}{\Large\sffamily\protect\centering #1\quad\mbox{}}}}{#1}}%
\@endpart}
\def\@endpart{\vfil\newpage
\if@twoside
\if@openright
\null
\thispagestyle{empty}%
\newpage
\fi
\fi
\if@tempswa
\twocolumn
\fi}

%======================================================================================
%   BIBLIOGRAPHY
%======================================================================================
\usepackage[sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{../References/chapter1.bib}% BibTeX
\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}

%======================================================================================
%   HYPERLINKS IN THE DOCUMENTS
%======================================================================================

\usepackage{hyperref}
\hypersetup{colorlinks=true,
            linkcolor = .,
            backref=true,
            %pagebackref=true,
            hyperindex=true,
            breaklinks=true,
            urlcolor=blue,
            citecolor = mybluei,
            bookmarks=true,
            bookmarksopen=false,
            pdftitle={Title},
            pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=mybluei,bold}%
\fi
}
}

\begin{document}

\part{One}
\chapter{This is IT}
\lipsum[1-3]

\part{Two}
\chapter{This is Another IT}
\lipsum[3-4]

\end{document} 
  • 1
    Why do you label this as koma-script whereas you use the book document class? Also, you shouldn't load both titletoc and fncyhdr. On the other hand, you mention scrlayer-scrpage, but load titlesec – Bernard May 18 '17 at 23:18
  • @Bernard, the given code is for the normal book class, I wanted to convert this code to work in the scrlayer-scrpage. Thanks. – Joe May 18 '17 at 23:32
  • I'm sorry, I don't know this package well enough. I can help with titlesec. – Bernard May 18 '17 at 23:34
  • 2
    scrlayer-scrpage does not provide facilities to change headings or to make a mini ToC. You could use it for the blue background. Your question is somehow like: How to use a spoon to cut my steak, isn't it? – Schweinebacke May 19 '17 at 5:39
2

Just change \setlength\ecart{1.2cm-\esp} to \setlength\ecart{6.2cm-\esp}

\documentclass{book}
\usepackage{calc}
\usepackage{graphicx, rotating, ltablex, dcolumn, booktabs}
\usepackage{siunitx}
\usepackage[english]{babel}
\usepackage[usenames,dvipsnames,svgnames,table,xcdraw]{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\usepackage{tikz}
\usepackage{colortbl}
\usepackage[version=4]{mhchem}
\usepackage{fixltx2e}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{avant}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%======================================================================================
%   PART HEADINGS
%======================================================================================
\usepackage[explicit,calcwidth]{titlesec}
\usepackage{titletoc} % Required for manipulating the table of contents
\usepackage{fourier}
\usepackage{etoolbox,fancyhdr} % Required for header and footer configuration
\pagestyle{fancy}

% Chapter text styling
\titlecontents{lchapter}[0em] % Indenting
{\addvspace{15pt}\large\sffamily\bfseries} % Spacing and font options for chapters
{\color{mybluei}\contentslabel[\Large\thecontentslabel]{1.25cm}\color{mybluei}} % Chapter number
{}
{\color{mybluei}\normalsize\sffamily\bfseries\;\titlerule*[.5pc]{.}\;\thecontentspage} % Page number

% Section text styling
\titlecontents{lsection}[0em] % Indenting
{\sffamily\small} % Spacing and font options for sections
{\contentslabel[\thecontentslabel]{1.25cm}} % Section number
{}
{}

% Subsection text styling
\titlecontents{lsubsection}[.5em] % Indentation
{\normalfont\footnotesize\sffamily} % Font settings
{}
{}
{}

\makeatletter

% numbered part in the table of contents
\newcommand{\@mypartnumtocformat}[2]{%
\setlength\fboxsep{0pt}%
\noindent\colorbox{mybluei!20}{\strut\parbox[c][.7cm]{\ecart}{\color{mybluei!70}\Large\sffamily\bfseries\centering#1}}\hskip\esp\colorbox{mybluei!40}{\strut\parbox[c][.7cm]{\linewidth-\ecart-\esp}{\Large\sffamily\centering#2}}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% unnumbered part in the table of contents
\newcommand{\@myparttocformat}[1]{%
\setlength\fboxsep{0pt}%
\noindent\colorbox{mybluei!40}{\strut\parbox[c][.7cm]{\linewidth}{\Large\sffamily\centering#1}}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\esp
\setlength\esp{4pt}
\newlength\ecart
\setlength\ecart{6.2cm-\esp}
\newcommand{\thepartimage}{}%
\newcommand{\partimage}[1]{\renewcommand{\thepartimage}{#1}}%
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax%
\refstepcounter{part}%
\addcontentsline{toc}{part}{\texorpdfstring{\protect\@mypartnumtocformat{\thepart}{#1}}{\partname~\thepart\ ---\ #1}}
\else%
\addcontentsline{toc}{part}{\texorpdfstring{\protect\@myparttocformat{#1}}{#1}}%
\fi%
\startcontents%
\markboth{}{}%
{\thispagestyle{empty}%
\begin{tikzpicture}[remember picture,overlay]%
\node at (current page.north west){\begin{tikzpicture}[remember picture,overlay]%   
\fill[mybluei!20](0cm,0cm) rectangle (\paperwidth,-\paperheight);
\node[anchor=north] at (4cm,-3.25cm){\color{mybluei!40}\fontsize{220}{100}\sffamily\bfseries\@Roman\c@part};
\node[anchor=south east] at (\paperwidth-1cm,-\paperheight+1cm){%
\parbox[t][][t]{\textwidth}{%
\columnsep=50pt
\begin{multicols}{2}
\printcontents{l}{0}{\setcounter{tocdepth}{1}}%
\end{multicols}}};
\node[anchor=north east] at (\paperwidth-1.5cm,-3.25cm){\parbox[t][][t]{15cm}{\strut\raggedleft\color{white}\fontsize{30}{30}\sffamily\bfseries#2}};
\end{tikzpicture}};
\end{tikzpicture}}%
\@endpart}
\def\@spart#1{%
\startcontents%
\phantomsection
{\thispagestyle{empty}%
\begin{tikzpicture}[remember picture,overlay]%
\node at (current page.north west){\begin{tikzpicture}[remember picture,overlay]%   
\fill[mybluei!20](0cm,0cm) rectangle (\paperwidth,-\paperheight);
\node[anchor=north east] at (\paperwidth-1.5cm,-3.25cm){\parbox[t][][t]{15cm}{\strut\raggedleft\color{white}\fontsize{30}{30}\sffamily\bfseries#1}};
\end{tikzpicture}};
\end{tikzpicture}}
\addcontentsline{toc}{part}{\texorpdfstring{%
\setlength\fboxsep{0pt}%
\noindent\protect\colorbox{mybluei!40}{\strut\protect\parbox[c][.7cm]{\linewidth}{\Large\sffamily\protect\centering #1\quad\mbox{}}}}{#1}}%
\@endpart}
\def\@endpart{\vfil\newpage
\if@twoside
\if@openright
\null
\thispagestyle{empty}%
\newpage
\fi
\fi
\if@tempswa
\twocolumn
\fi}

%======================================================================================
%   BIBLIOGRAPHY
%======================================================================================
\usepackage[sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{../References/chapter1.bib}% BibTeX
\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}

%======================================================================================
%   HYPERLINKS IN THE DOCUMENTS
%======================================================================================

\usepackage{hyperref}
\hypersetup{colorlinks=true,
            linkcolor = .,
            backref=true,
            %pagebackref=true,
            hyperindex=true,
            breaklinks=true,
            urlcolor=blue,
            citecolor = mybluei,
            bookmarks=true,
            bookmarksopen=false,
            pdftitle={Title},
            pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=mybluei,bold}%
\fi
}
}

\begin{document}

\part{One}
\chapter{This is IT}
\lipsum[1-3]

\part{Two}
\chapter{This is Another IT}
\lipsum[3-4]

\end{document} 

enter image description here enter image description here

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.