\documentclass[twoside]{book}
\usepackage{fancyhdr}
\makeatletter
\newenvironment{tablehere}
{\def\@captype{table}}
{}
\makeatother
\fancyhead{}
\fancyhead[RO, LE]{\framebox[9\width][s]{se separan}}
\fancyfoot{}
\fancyfoot[LE, RO]{\thepage}
\fancyfoot[LO, CE]{Chapter \thechapter}
\makeatletter
\let \ps@plain\ps@fancy
\makeatother
\pagestyle{fancy}
\begin{document}
% \input{title}
\chapter{Introduction}
...
\chapter{Background}
...
\chapter{Conclusion}
...
\newpage
afjdajf
\newpage
sagfajg
\end{document}
1 Answer
For diagonal lines, you need TikZ. Also, fancyhdr tends to change \headheight
from one page to the next, so I used \myheight
instead. (TikZ draws slightly outside the bounds.) The strut is used to align the page number and "Chapter".
Needless to say, you can always adjust the position of the text relative to the tikz coordinates.
\documentclass[twoside]{book}
\usepackage{fancyhdr}
\usepackage{tikz}
\makeatletter
\newenvironment{tablehere}
{\def\@captype{table}}
{}
\makeatother
\newlength{\myheight}% fancyhdr changes \headheight from one page to the next.
\setlength{\myheight}{\dimexpr \ht\strutbox+\dp\strutbox+.666em}
\setlength{\headheight}{\dimexpr \myheight+0.5pt}% width of tikz lines
\fancyhead{}
\fancyhead[CE]{\begin{tikzpicture}
\path[draw=black,fill=orange]
(0,0) -- (.7\textwidth,0) -- (.8\textwidth,\myheight) -- (0,\myheight) -- cycle;
\path[draw=black,fill=gray]
(.7\textwidth,0) -- (\textwidth,0) -- (\textwidth,\myheight) -- (.8\textwidth,\myheight) -- cycle;
\path (0,0) node[above right] {\chaptername~\thechapter\strut}
(\textwidth,0) node[above left] {\thepage\strut};
\end{tikzpicture}}
\fancyhead[CO]{\begin{tikzpicture}\path[draw=black,fill=gray]
(0,0) -- (.3\textwidth,0) -- (.2\textwidth,\myheight) -- (0,\myheight) -- cycle;
\path[draw=black,fill=orange]
(.3\textwidth,0) -- (\textwidth,0) -- (\textwidth,\myheight) -- (.2\textwidth,\myheight) -- cycle;
\path (0,0) node[above right] {\thepage\strut}
(\textwidth,0) node[above left] {\chaptername~\thechapter\strut};
\end{tikzpicture}}
\makeatletter
\let \ps@plain\ps@fancy
\makeatother
\pagestyle{fancy}
\begin{document}
% \input{title}
\chapter{Introduction}
...
\chapter{Background}
...
\chapter{Conclusion}
...
\newpage
afjdajf
\newpage
sagfajg
\end{document}
{ }
button above the input field. (I see that a helpful person has already implemented my advice. Good.)