# Make headers with a predetermined image

I'm writing a book in LaTeX and I need to do the headers with the publisher's stye. That styles uses an image in every header but with two different texts: the even pages contain the title of the book and the odd pages contain the title of the chapter. It's something like this

And this what I have for now.

How can I make the headers with an predertmined image but with different texts depending on the chapter?

This is a MWE of my book.

\documentclass[letterpaper,reqno]{book}
\listfiles
\usepackage{makeidx}
\usepackage[spanish,es-nosectiondot]{babel}
\usepackage[utf8]{inputenc}
\usepackage{infwarerr}
\usepackage{color}
\usepackage{verbatim} %Para comentar bloques de texto
\usepackage[text={168mm,240mm},centering]{geometry}%Define el ancho y la    altura del texto (Página)
\usepackage{amssymb,amsmath,amsthm}
\usepackage{epsfig,graphicx,psfrag,float}
\usepackage{ltxcmds}
\usepackage[pdf]{pstricks}
\usepackage[all]{xy}
\usepackage{tocloft}% Este paquete modifica los parámetros de la Tabla de   Contenidos (ToC)
\usepackage{fancyhdr}
\usepackage{enumerate}
\usepackage{hyperref}

\makeindex

\renewcommand{\cftchappresnum}{Capítulo }
\renewcommand{\cftchapaftersnum}{}
\renewcommand{\cftchapaftersnumb}{\\ }
\renewcommand{\cftchapnumwidth}{0mm}

\renewcommand{\chaptermark}[1]{\markboth{Algebra}{\chaptername\ \thechapter.\ #1}}

\begin{document}
\pagenumbering{roman}
\tableofcontents
\pagenumbering{arabic}

\include{EnsayoPrefacio}
\include{Ensayos}
\include{Index}
\printindex

\end{document}


• This is a MWE of my book. – Fabio Jul 17 '17 at 16:16
• For really fancy headers, you need to use everypage and tikz. See tex.stackexchange.com/questions/276358/… for example. – John Kormylo Jul 18 '17 at 3:42
• Crosspost latex.org/forum/… – Johannes_B Jul 27 '17 at 7:20
• It is unacceptable to see that you a) don't openly show your crossposts and b) you don't update your question with the info gained at the other site. – Johannes_B Jul 27 '17 at 7:21

Finally I got a solution. This topic was posted in other forum and there I was given the solution. Someone gave this code and I just had to edit it a little bit.

\listfiles % the usual place for \listfiles is here: above \documentclass. Easier to cleanup after troubleshooting all the issues, IMHO.
\documentclass[letterpaper,reqno]{book}
\usepackage[spanish,es-nosectiondot]{babel}
\usepackage[utf8]{inputenc}
\usepackage[text={168mm,240mm},centering]{geometry}
\usepackage{%epsfig,<-- do you really need that?
graphicx%,psfrag,float
}
\usepackage{fancyhdr}
\usepackage{blindtext}
\pagestyle{fancy}
\fancyhf{}
\hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
}\thepage}
\hspace{-0.5em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
}\thepage}
\hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p2}}%
}\leftmark}
\renewcommand*\footrulewidth{0pt}
\begin{document}
\Blinddocument
\Blinddocument
\end{document}


Thanks for everything. This topic can be considered closed.

• You should attribute the code to its author and provide a link. Mere basic courtesy. – cfr Jul 28 '17 at 0:20
• You are right and I apologize. This solution was given by rais and this is the links where you can see it latex.org/forum/viewtopic.php?f=5&t=29954 – Fabio Jul 28 '17 at 1:22

everybody. I've been making several mistakes everytime I participate in this forum. I'm sorry about that.

The solution to my problem was to introduce and edit this code:

\fancyhf{}
\hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
}\thepage}