{scrlayer-scrpage} 中的部分页面格式

{scrlayer-scrpage} 中的部分页面格式

我遇到了这种“零件”页面格式,但想使用来实现它{scrlayer-scrpage}。我该如何实现它,以便我可以让我的“零件”页面显示如下:

在此处输入图片描述

原始代码如下:

\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

只需将 \setlength\ecart{1.2cm-\esp} 更改为 \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} 

在此处输入图片描述 在此处输入图片描述

相关内容