3

I'm having a little problem with a custom chapter style in memoir class. I want to have the chapter titles behaving like parts, i.e. having the title on a separate page.

I can do it like so:

\makechapterstyle{emmanuel}{%
\chapterstyle{ger}
\renewcommand{\afterchaptertitle}{\cleardoublepage}
}

Trouble is, in the toc, the page number displayed for the chapter is the one for the next page. I take it that this is due to the chapter actually starting right before page (n+2), but I would like to have it starting on the page title (i.e. n)

I hope it is clear enough.

1
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Apr 10, 2013 at 22:03

1 Answer 1

2

You can redefine the internal \@chapter command to include the \cleardoublepage command at the appropriate location (if you do it too early, the wrong page number will be picked for the ToC):

\documentclass{memoir}
\usepackage{hyperref}
\usepackage{lipsum}% just to generate text for the example

\makeatletter
\newcommand\chapterclear{
\gdef\@chapter[##1]##2{%
  \m@mpn@new@chaptrue%
  \m@mpn@new@schapfalse%
  \def\f@rbdy{##2}%
  \ifx\ch@pt@c\@empty % no optional args
    \def\f@rtoc{##2}%
    \def\f@rhdr{##2}%
  \else                  % at least one opt arg
    \let\f@rtoc\ch@pt@c
    \ifx\@empty##1\@empty
      \let\f@rhdr\ch@pt@c
    \else
      \def\f@rhdr{##1}%
    \fi
  \fi
  \m@m@Andfalse
  \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
      \m@m@Andtrue
    \fi
  \fi
  \ifm@m@And
    \refstepcounter{chapter}%
  \fi
  \ifartopt
    \@makechapterhead{##2}%
    \@afterheading
    \chaptermark{\f@rhdr}%
  \else
    \chaptermark{\f@rhdr}
    \insertchapterspace
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
    \fi
    \@afterheading
  \fi
  \ifm@m@And
    \ifanappendix
      \addcontentsline{toc}{appendix}{%
        \protect\chapternumberline{\thechapter}\f@rtoc}%
      \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{##2}%
    \else
      \addcontentsline{toc}{chapter}{%
        \protect\chapternumberline{\thechapter}\f@rtoc}%
      \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{##2}%
    \fi
  \else
    \addcontentsline{toc}{chapter}{\f@rtoc}%
    \ifanappendix
      \memappchapinfo{}{\f@rtoc}{\f@rhdr}{##2}%
    \else
      \memchapinfo{}{\f@rtoc}{\f@rhdr}{##2}%
    \fi
  \fi
  \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi
  \cleardoublepage}%
}
\makeatother

\makechapterstyle{emmanuel}{
  \chapterstyle{ger}
  \chapterclear
}

\begin{document}

\tableofcontents
\chapterstyle{emmanuel}
\chapter{Test}
\lipsum[1-10]
\chapter{Test}
\lipsum[1-10]

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .