删除目录后的白页

删除目录后的白页

我正在为 LaTeX 书籍做设置,我正在使用 overleaf。如果你尝试编译此代码

\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[tmargin=2cm,rmargin=4cm,lmargin=4cm,bmargin=2cm]{geometry}
\usepackage{kpfonts}
\usepackage{pdfpages}
\usepackage{tikz}
\usepackage{color}   %May be necessary if you want to color links
\usepackage{hyperref}
\usepackage{graphics}
\definecolor{doc}{RGB}{28, 103, 173}
\definecolor{custom}{RGB}{255,255,255}
\usepackage{titletoc}
\contentsmargin{0cm}

\titlecontents{part}[0pc]
{\addvspace{20pt}}%
{\begin{tikzpicture}[remember picture, overlay]%
\draw[fill=doc!60,draw=doc!60] (-4,-.2) rectangle (-0.5,.5);%
\pgftext[center,x=-1.0cm,y=0.2cm]{\color{white}\Large\sc\bfseries \                                             
\thecontentslabel};%
\end{tikzpicture}\color{doc!60}\large\sc\bfseries}
{\color{doc!60}\large\sc\bfseries}
{\color{doc!60}\;\titlerule\;\large\sc\bfseries Page \thecontentspage}%

\titlecontents{chapter}[0pc]
{\addvspace{20pt}}%
{\begin{tikzpicture}[remember picture, overlay]%
\draw[fill=doc!60,draw=doc!60] (-4,-.2) rectangle (-0.5,.5);%
\pgftext[center,x=-1.0cm,y=0.2cm]{\color{white}\Large\sc\bfseries \                                             
\thecontentslabel};%
\end{tikzpicture}\color{doc!60}\large\sc\bfseries}
{\color{doc!60}\large\sc\bfseries}
{\color{doc!60}\;\titlerule\;\large\sc\bfseries Page \thecontentspage}%

\titlecontents{section}[2.4pc]
{\addvspace{1pt}}
{\contentslabel[\thecontentslabel]{2.4pc}}
{}
{\dotfill\small \thecontentspage}
[]
\titlecontents{subsection}[5pc]
{\addvspace{1pt}}
{\contentslabel[\thecontentslabel]{2.4pc}}
{}
{\dotfill\small \thecontentspage}
[]
\makeatletter

\setlength{\parindent}{0cm}

\renewcommand{\tableofcontents}{%
\chapter*{%
\vspace*{-20\p@}%
\begin{tikzpicture}[remember picture, overlay]%
\pgftext[right,x=15cm,y=0.2cm]{\color{doc!60}\Huge\sc\bfseries    
\contentsname};%
\draw[fill=doc!60,draw=doc!60] (13,-.75) rectangle (20,1);%
\clip (13,-.75) rectangle (20,1);
\pgftext[right,x=15cm,y=0.2cm]{\color{white}\Huge\sc\bfseries 
\contentsname};%
\end{tikzpicture}}%
\@starttoc{toc}}
\makeatother

\usepackage{titlesec, blindtext, color}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{doc}{|}\hsp}{0pt}{\Huge\bfseries}

\begin{document}
% FRONT PAGE
\includepdf{images/frontpage.png}
\clearpage

\thispagestyle{empty}
\begin{center}
    \emph{Dedicated to my family, Giorgia and my friends}
\end{center}
\clearpage

\tableofcontents

\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}

cccc

\chapter{Basics of Dart}
Some text goes here

\clearpage
\section{Start}
aaa

\end{document}  

你会注意到,在目录之后和章节之后介绍有一个白页我无法摆脱。

如何删除目录和简介后的白页?

答案1

这将删除该页面,但简介将从错误的页面开始:

\tableofcontents

{
\let\cleardoublepage\clearpage
\chapter*{Introduction}
}
\addcontentsline{toc}{chapter}{Introduction}

cccc

相关内容