# Insert page before each chapter

I would like to insert a page before each chapter with the tile of the chapter. How we can accomplish this in latex...?

The structure of my latex document is as below:

documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,graphicx,color,algorithm,float,caption,mathtools}
\usepackage{url,rotating,multirow}
\usepackage{algpseudocode,pdfpages}
\usepackage[normalem]{ulem}
\usepackage{breqn}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}

\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C] {\thepage}

\begin{document}

\cleardoublepage
\pagenumbering{gobble}
\includepdf[pages={-}]{certificate/certi.pdf}
\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagenumbering{arabic}

\include{abstract/abstract}
\include{introduction/intro}
\include{survey/survey}
\include{chapter1/chapter1}
\include{chapter2/chapter2}
\include{chapter3/chapter3}
\include{chapter4/chapter4}
\include{chapter5/chapter5}
\include{results/results}
\include{conclusion/conclusion}
%references will go here
\renewcommand{\bibname}{References}
\bibliographystyle{plain}

\bibliography{References/references}
\end{document}


I want a page before each chapter starts consisting the title of the chapter...For example, if the chapter one named "Some Chapter Name" is starting from page number 10, then I would like to insert a page before page number 10 having the text " Chapter 1 Some Chapter Name

• assuming you mean a two-sided page, with the title on the front, and the back blank, \part* should do what you want. – barbara beeton Jun 6 '14 at 18:19
• @barbarabeeton: No I am interested in single sided page..You can see the first line in the above code"documentclass[a4paper,11pt]{report}" – Galaxy Jun 6 '14 at 18:22
• I want a page before each chapter starts consisting the title of the chapter...For example, if the chapter one named "Some Chapter Name" is starting from page number 10, then I would like to insert a page before page number 10 having the text " Chapter 1 Some Chapter Name" – Galaxy Jun 6 '14 at 18:25
• Your MWE cannot be compiled due to this huge amount of \include{chapter...} code and  is missing before \documentclass – user31729 Jun 6 '14 at 19:10

Redefine the chapter command to execute some start code before, in its easyiest form, you have to use a clearpage before, using the old pagestyle, then use plain pagestyle and add the page code, afterwards switch back to old fancy pagestyle.

Since there are \chapter[]{} and \chapter{} forms of the \chapter command, both have to be catched.

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,graphicx,color,algorithm,float,caption,mathtools}
\usepackage{url,rotating,multirow}
\usepackage{algpseudocode,pdfpages}
\usepackage[normalem]{ulem}
\usepackage{breqn}
\usepackage{blindtext}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}

\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C] {\thepage}

\let\LaTeXStandardChapter\chapter%

\newcommand{\chapterstartpage}[1]{%
\clearpage% Clearpage first, then use pagestyle plain
\pagestyle{plain}%
\begingroup
\centering%
\Huge \textbf{\chaptername~\thechapter}%%

%% Add more space here, do more formatting also here
\vspace{\baselineskip}%
\textbf{#1}%
\endgroup
\clearpage
\pagestyle{fancy}%
}%

\makeatletter
\newcommand{\chapter@noopt}[1]{%
\chapterstartpage{#1}%
\LaTeXStandardChapter{#1}%
}%

\newcommand{\chapter@opt}[2][]{%
\chapterstartpage{#2}%
\LaTeXStandardChapter[#1]{#2}%
}%

\newcommand{\unstarredchapter}{%
\@ifnextchar[{\chapter@opt}{\chapter@noopt}%
}%

\newcommand{\starredchapter}[1]{%
\LaTeXStandardChapter*{#1}
}%

\renewcommand{\chapter}{%
\@ifstar{\starredchapter}{\unstarredchapter}%
}%

\makeatother

\begin{document}

\cleardoublepage
\pagenumbering{gobble}
%\includepdf[pages={-}]{certificate/certi.pdf}
\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagenumbering{arabic}

\chapter{Some sophisticated chapter}%

\chapter{Another sophisticated chapter}%

\blindtext[5]

\chapter{Yet another sophisticated chapter}%

\blindtext[5]

%\include{abstract/abstract}
%\include{introduction/intro}
%\include{survey/survey}
%\include{chapter1/chapter1}
%\include{chapter2/chapter2}
%\include{chapter3/chapter3}
%\include{chapter4/chapter4}
%\include{chapter5/chapter5}
%\include{results/results}
%\include{conclusion/conclusion}
%references will go here

%\renewcommand{\bibname}{References}
%\bibliographystyle{plain}

%\bibliography{References/references}
\end{document}


Another variation on the theme which uses xparse to redefine \chapter along with its standard variants. Adjust and enjoy if so inclined.

I've assumed that there may be some cases where you wish to revert to the previous definition of \chapter. I've used the table of contents to demonstrate one way of achieving this.

\documentclass[a4paper, 11pt]{report}
\let\origchapter\chapter
\DeclareDocumentCommand\chapter{s o m}{%
\IfNoValueTF{#2}{\def\myshortchtitle{#3}}{\def\myshortchtitle{#2}}%
\clearpage
\thispagestyle{empty}%
\vspace*{.25\textheight}%
{\centering
\stepcounter{chapter}%
\LARGE\bfseries
\IfBooleanTF{#1}{%
\phantom{\chaptername\ \thechapter}}{%
\chaptername\ \thechapter}\par
\vskip .025\textheight
\Huge #3\par
\clearpage
\IfBooleanTF{#1}{%
\origchapter*{#3}}{%
\origchapter[\myshortchtitle]{#3}}}

\begin{document}

\let\oldchapter\chapter% if you don't want the ToC to have a page before it
\let\chapter\origchapter% if you don't want the ToC to have a page before it
\tableofcontents
\let\chapter\oldchapter% if you don't want the ToC to have a page before it

\chapter*[Short Starred Title]{A Starred Chapter}

\chapter{A Chapter}

\chapter{Another Chapter}

\chapter[Short Title]{An Exceptionally Long Chapter Title}

\end{document}


• I have inserted your code in my latex document however it is not compiling. The error shown by the TexMaker is :\if_num:w' already defined! Current meaning: \ifnum. – Galaxy Jun 7 '14 at 11:31
• Try commenting the loading of xparse. Maybe something else is already loading it. – cfr Jun 7 '14 at 20:19
• @user2123967 I can't reproduce that using the code you posted in the question. Obviously, I can't test with your \include statements or actually generate your bibliography etc., but I added the rest in with no problem. So something else causes the conflict. You need to look at the context of that error. The best thing is to run the compilation from the command line so you can see what's happening. That way, you can figure out what's causing the conflict. – cfr Jun 7 '14 at 20:37

\chapter could be redefined to catch the arguments (non-trivial, because of star form and optional argument).

A starting point:

\documentclass[a5paper,11pt]{report}
\usepackage{color}
\usepackage{lipsum}

\makeatletter
\newcommand*{\SavedChapter}{}
\let\SavedChapter\chapter
\renewcommand*{\chapter}{%
\clearpage
% \if@openright\cleardoublepage\else\clearpage\fi % \chapter/report.cls
\secdef\NormalChapter\StarChapter
}
\newcommand*{\NormalChapter}{}
\def\NormalChapter[#1]#2{%
\stepcounter{chapter}%
\ChapterPage[\@chapapp\space\thechapter]{#2}%
\SavedChapter[{#1}]{#2}%
}
\newcommand*{\StarChapter}[1]{%
\ChapterPage{#1}%
\SavedChapter*{#1}%
}
\newcommand*{\ChapterPage}[2][]{%
\begingroup
\color{red}
\def\ChapterTemp{#1}%
\ifx\ChapterTemp\@empty
\else
\fi
\endgroup
}
\makeatother

\begin{document}
\tableofcontents
\chapter{Introduction}
\lipsum[2]
\end{document}


• (+1) Because this seemed to me a lot easier with xparse, I was just wondering if there is some reason to avoid using it. – cfr Jun 6 '14 at 22:55
• @cfr: I don't think it is easier: Another complexity level is added. And the argument syntax of \chapter is quite complex, s o m is not correct, because starred chapters do not have an optional argument. Also the default for the optional argument is the following mandatory argument. – Heiko Oberdiek Jun 6 '14 at 23:21
• Fair enough. I found it easier (even with the complication you mention) but I really wanted to check there was not some strong reason to avoid xparse` in this case. It is true that my definition will silently ignore the optional argument if it is erroneously passed to the starred version. I could change this but it seemed relatively harmless. (But maybe it is not.) – cfr Jun 7 '14 at 0:24