18.11.12

Redefine memoir Part to allow image in memoir class


First we define a command to set the image name for each part. This command takes the same arguments as the \includegraphics command from the graphicx package. Then we add the image to the memoir class \printparttitle command. You can play with the \vfilcommands to change the vertical spacing as you require it.
\documentclass{memoir}
\usepackage[demo]{graphicx}
\makeatletter
% define a user command to choose the image
% this command also creates an internal command to insert the image
\newcommand{\partimage}[2][]{\gdef\@partimage{\includegraphics[#1]{#2}}}
\renewcommand{\printparttitle}[1]{\parttitlefont #1\vfil\@partimage\vfil}
\makeatother
\begin{document}
\partimage{foo.png}
\part{A part}
\partimage[width=\textwidth]{bar.png}
\part{Another part}
\end{document}
output of first part page

No hay comentarios:

Publicar un comentario