2

Hello I am trying to "publish" my 9yr old's story using the memoir class. I want to use the built in thatcher chapterstyle but modify it to include an image above the chapter title (I want the same image for every chapter). I have tried inserting this

\centering\includegraphics[scale=0.25]{pic} 

into various parts of the following chapterstyle code, and though I can get it to appear within the title (mucking up the whitespace) I can't get it where I want - above the entire title (ie. so the image is the top-most thing on the page.)

\makechapterstyle{anna}{%
  \chapterstyle{default}
    \renewcommand*{\chapterheadstart}{}
   \renewcommand*{\printchaptername}{%
    \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeTextLowercase}
  \renewcommand*{\printchapternum}{}
  \renewcommand*{\afterchapternum}{%
    \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
  \renewcommand*{\printchapternonum}{%
    \vphantom{\chapnumfont \@chapapp 1}\par
    \parbox{0.5in}{}\par}
  \renewcommand*{\chaptitlefont}{\normalfont\large}
  \renewcommand*{\printchaptertitle}[1]{%
    \centering 
    \chaptitlefont \MakeTextUppercase{##1}}}    
%\chapterstyle{thatcher}
\chapterstyle{anna}

It is a few years since I have programmed or used Latex, I don't really understand what is happening in the above code. I HAVE read all the other relevant posts on this forum that I could find - I thought this could help me but it's slightly different so I am still stuck. If anyone can help I would be very grateful.

Thank you in advance,

*EDIT: Sorry about that. Here is a complete working example of my code.

\documentclass[12pt,a4paper,openany]{memoir}
\flushbottom
\usepackage{graphicx}
\usepackage{quattrocento}
\usepackage{verse}
\usepackage[normalem]{ulem}

%% BEGIN TITLE - THIS PRINTS TITLE AND AUTHOR ON FIRST PAGE

\makeatletter
\def\maketitle{%
  \null
  \thispagestyle{empty}%
  \vfill
  \begin{center}\leavevmode
    \normalfont
    {\LARGE\raggedleft \@author\par}%
    \hrulefill\par
    {\huge\raggedright \@title\par}%
    \vskip 1cm
%    {\Large \@date\par}%
  \end{center}%
  \vfill
  \null
  \cleardoublepage
  }
\makeatother
\author{author name}
\title{A Mouse's Tale}
\date{}

\begin{document}

\let\cleardoublepage\clearpage 

\maketitle

\frontmatter


\begin{center}

all the usual publisher and copyright info 

\end{center}

\let\cleardoublepage\clearpage %THIS IS NOT CALLED AGAIN

\def\@chapapp{CHAPTER}

\makechapterstyle{anna}{%
  \chapterstyle{default}
    \renewcommand*{\chapterheadstart}{}
  \renewcommand*{\printchaptername}{%
    \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeTextLowercase}
  \renewcommand*{\printchapternum}{}
  \renewcommand*{\afterchapternum}{%
    \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
  \renewcommand*{\printchapternonum}{%
    \vphantom{\chapnumfont \@chapapp 1}\par
    \parbox{0.5in}{}\par}
  \renewcommand*{\chaptitlefont}{\normalfont\large}
  \renewcommand*{\printchaptertitle}[1]{%
    \centering 
    \chaptitlefont \MakeTextUppercase{##1}}}    
%\chapterstyle{thatcher}
\chapterstyle{anna}

\mainmatter
\sloppy

\chapter{Hunt for cheese}

\textit{Pitter} \textit{patter} pitter pattered my feet. As a mouse we always had to hunt, or find food and this was my task. Under the dining table I went. \textit{Bing bong}, \textit{bing bong}, the clock struck two.

\end{document}

*2ND EDIT:

\makechapterstyle{anna}{%
  \chapterstyle{default}
    \renewcommand*{\chapterheadstart}{ \centering\includegraphics[scale=0.25]{pic}}

Adding the \includegraphics right after \chapterheadstart is the closest I've come. but it puts the graphic out to the left and pushes the 'chapter number' text out to the right (when usually it is centered). I need some vertical space in there I think.

  • Welcome to TeX.SX! You don't have to sign with your name since it automatically appears in the lower right corner of your post. – Jesse Oct 28 '14 at 2:21
  • 2
    Could you please complete your code so that it makes a complete, small example people can compile to play with and test? This makes it a lot easier to help and a lot more likely the solutions will hit the spot! – cfr Oct 28 '14 at 2:28
  • If memory serves, \chapterheadstart is the likely 'entry point' for what you hope to achieve. But, as @cfr says, you make everyone's life easier, including your own, if you provide a minimal example (or see here). – jon Oct 28 '14 at 4:38
  • In the manual there are two lists showing how the macros are actually used. One of the things you do not list is the macro responsible for the space above the macro, ie the macro that adds the \vspace*, I would modify/add to that macro to insert the image – daleif Oct 28 '14 at 7:59
  • \renewcommand{\chapterheadstart}{{\centering\rule{3em}{4em}\vspace*{2em}\par}} – Johannes_B Oct 28 '14 at 9:07
1

Advanced classes like memoir and the KOMA-script classes define commands for nearly every possible instance to hook into. In your case this is \chapterheadstart. You can of course renew the command after defining, but it would be certainly more clean to use this in the \makechapterstyle definition.

\documentclass{memoir}
%
\def\@chapapp{Chapter}%
\makechapterstyle{anna}{%%
    \chapterstyle{default}%
    \renewcommand*{\chapterheadstart}{}%
    \renewcommand{\chapterheadstart}{{\centering\rule{3em}{4em}\par\vspace*{2em}}}%<------------
    \renewcommand*{\printchaptername}{%%
        \centerline{\chapnumfont{\@chapapp\ \thechapter}}%
    }%
    \renewcommand*{\chapternamenum}{}%
    \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeTextLowercase}%
    \renewcommand*{\printchapternum}{}%
    \renewcommand*{\afterchapternum}{%%
        \par\centerline{\parbox{0.5in}{\hrulefill}}\par}%
        \renewcommand*{\printchapternonum}{%%
            \vphantom{\chapnumfont \@chapapp 1}\par%
            \parbox{0.5in}{}\par%%
        }%
        \renewcommand*{\chaptitlefont}{\normalfont\large}%
        \renewcommand*{\printchaptertitle}[1]{%%
            \centering %
            \chaptitlefont \MakeTextUppercase{##1}%
        }%
    }    %
    \chapterstyle{anna}%
%

\begin{document}

\chapter{Hunt for cheese}

\emph{Pitter} \emph{patter} pitter pattered my feet. As a mouse we always had to hunt, or find food and this was my task. Under the dining table I went. \emph{Bing bong}, \emph{bing bong}, the clock struck two.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.