# How to have header in some particular pages?

In document class "report", in some particular pages, I would like to have two kinds of headers. I want that the header for the odd pages is as follows:

Title1 ................................................. Page number


and accordingly, the header for the even pages as follows:

Page number ............................................ Title2


I should to explain that title 1 is related to the "name of my report" and title 2 is fixed and is independent of the chapter name. In the following, I have mentioned my work:

\documentclass[11pt,a5paper,twoside]{report}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[top=25mm, bottom=25mm, left=20mm, right=20mm]{geometry}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{framed}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{indentfirst}
\usepackage{emptypage}
\usepackage{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{algorithm,algcompatible}
\usepackage{subcaption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\usepackage{times}
\usepackage{cite}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\titleformat{\chapter}[display]
{}{}{1ex}{\bfseries\fontsize{15}{16}\selectfont}[]
\begin{document}
\pagenumbering{alph}
\tableofcontents
\cleardoublepage
\pagestyle{plain}
\pagenumbering{arabic}
This is my work.
\end{document}


How can I do it?

Thank you

• Define a page style (with fancyhdr or titleps) and apply it. – Bernard Jan 17 '18 at 22:37
• @ Bernard , Unfortunately, I do not know how can I do it. Can you please help me? – Farid Jan 17 '18 at 22:39
• We can, but please post a minimal compilable example, with the relevant part of your preamble. – Bernard Jan 17 '18 at 22:41
• @Bernard , I edited my question. Thank you so much. – Farid Jan 17 '18 at 22:47
• What would be these titles (1 and 2)? I suppose, not pre-deined, but depending on the chapter or section titles? And for which kind of pages should it be used? – Bernard Jan 17 '18 at 23:18

Here is a simple solution with titleps, which is loaded with the pagestyles option of titlesec. Likewise, the  clearempty option replaces loading the emptypage package.

Note the first page of chapters (if any) still have the plain page style (page number centred in the footer). This can be modified, either adding a command in \titleformat{\chapter} or re-defining the plain page style with \renewpagestyle{plain}.

I took the opportunity to simplify the options for geometry. Some other remarks: hyperref should be loaded as the last package, with very few exceptions (most notably cleveref should be loaded afterwards). Also, if you have maths in your document (I suppose so, since you load mathtools), you should use a maths font which fits times – I loaded newtxmath for that, which is based on the Times-clone TeX Gyre Termes, ad I'd recommend, if you're allowed to replace times, to load also newtxtext, to have true small caps and some other delicacies.

\documentclass[11pt,a5paper,twoside, dvipsnames]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[vmargin=25mm, hmargin=20mm]{geometry}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{framed}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{indentfirst}
\usepackage{emptypage}
\usepackage[pagestyles, clearempty]{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{algorithm,algcompatible}
\usepackage{subcaption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\usepackage{times, newtxmath}
\usepackage{cite}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[toc]{blindtext} %for demonstrating purposes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\titleformat{\chapter}[display]
{}{}{1ex}{\bfseries\fontsize{15}{16}\selectfont}[]

\newpagestyle{myps}{%
\setfoot{}{}{}
}%

\begin{document}

\pagenumbering{alph}
\tableofcontents
\cleardoublepage
\pagestyle{myps}
\pagenumbering{arabic}

\chapter{A First Chapter}
\Blindtext[5][2]
\chapter{A Second Chapter}
\Blindtext[2][5]

\end{document}


\documentclass[11pt,a5paper,twoside]{report}
\usepackage{lipsum}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[top=25mm, bottom=25mm, left=20mm, right=20mm]{geometry}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{framed}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{indentfirst}
\usepackage{emptypage}
\usepackage{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{algorithm,algcompatible}
\usepackage{subcaption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\usepackage{times}
\usepackage{cite}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhf{}
\fancypagestyle{plain}{%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\titleformat{\chapter}[display]
{}{}{1ex}{\bfseries\fontsize{15}{16}\selectfont}[]

You can use \dotfill command instead of \hrulefill for dotted header.