使用预定图像制作标题

使用预定图像制作标题

我正在用 LaTeX 写一本书,我需要用出版商的样式来制作页眉。该样式在每个页眉中使用一张图片,但包含两种不同的文本:偶数页包含书名,奇数页包含章节标题。它类似于以下内容 我需要模仿的样本 我需要模仿的样本

这就是我现在所拥有的。 我现在拥有的 在此处输入图片描述

我怎样才能制作具有预定图像但根据章节使用不同文本的标题?

这是我的书的 MWE。

\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{pstricks-add,pst-math,pst-xkey,pst-pdf,auto-pst-pdf}
\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}

\addcontentsline{toc}{chapter}{Prefacio}
\include{EnsayoPrefacio}
\include{Ensayos}
\include{Index}
\printindex

\end{document}

感谢您的帮助。

答案1

最后我终于找到了解决方案。这个主题发布在其他论坛上,然后我就找到了给出解决方案。有人给出了这个代码,我只需要稍微编辑一下。

\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{}
\fancyhead[RE]{Algebra}
\fancyhead[LE]{\makebox[0pt][l]{%
  \hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
  }\thepage}
\fancyhead[RO]{\makebox[0pt][l]{%
  \hspace{-0.5em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
  }\thepage}
\fancyhead[LO]{\makebox[0pt][l]{%
  \hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p2}}%
  }\leftmark}
\renewcommand*\headrulewidth{0pt}
\renewcommand*\footrulewidth{0pt}
\begin{document}
  \Blinddocument
  \Blinddocument
\end{document}

谢谢你的一切。这个话题可以算是结束了。

答案2

各位。我每次参加这个论坛都会犯一些错误。对此我深感抱歉。

解决我的问题的方法是引入并编辑此代码:

\fancyhf{}
\fancyhead[RE]{Algebra}
\fancyhead[LE]{\makebox[0pt][l]{%
\hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
}\thepage}
\fancyhead[RO]{\makebox[0pt][l]{%
\hspace{-0.5em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p1}}%
}\thepage}
\fancyhead[LO]{\makebox[0pt][l]{%
\hspace{-4em}\raisebox{-1ex}{\includegraphics[height=4ex]{foo-p2}}%
}\leftmark}
\renewcommand*\headrulewidth{0pt}
\renewcommand*\footrulewidth{0pt}

这是latex.org 论坛

我只是用 \includegraphics 添加了灰色条并编辑了垂直位置。

相关内容