3

First of all: I read through many possible solutions here, but none seem to work for me. I want to rename the last chapter of a book to be named "Epilogue" in the ToC and for all similar purposes AND have a 'real' name. So what I have now is:

Chapter heading:

enter image description here

Top of page in the epilogue:

enter image description here

Table of contents:

enter image description here

What I WOULD like to have is this: enter image description here

So far I have tried putting different commands in front of the last \chapter{} but it usually changed only a part, and never worked on the ToC, so I figured the trick might be somewhere in the definition of the ToC. EDIT: This is the most minimal example that I can produce in a reasonable time by checking if something breaks when I comment out stuff, as I don't understand most of the advanced commands yet.

Bonus question: Could something be easily changed so that the odd and even side margins are different, so that it would be more suitable for printing?

\documentclass[12pt,extrafontsizes,twoside,openright,final]{memoir}
\begin{document}
\tableofcontents*
\chapter{Once upon a time}
there was a princess (more text here, so that it is actually
at least 3 pages)
\fixepilogue
\chapter{Epilogue: Ending}
then she died (more text here, so that it is actually at
least 3 pages)
\end{document}
  • Could you please provide us with a minimal working example (MWE) that replicates your current behaviour? We're not interested in the nifty font, or all of the chapters you list... just something we can copy-and-paste-and-compile and see a regular chapter followed by another chapter that you want to style to be different of. – Werner May 29 '15 at 19:38
  • Can it be 500 lines long? Because I really don't know what I can cut off, as it is just a template I am adapting, and its freakishly complicated :( – Maxim Moloshenko May 29 '15 at 20:43
  • No, that's not minimal. The code you've provided thus far uses (just as an example), \hp, and \IfInteger and we have to figure out which package provides those or what they mean. Since we're suppose to help you, you should make it easy for us to get on the same page as you, regardless of how complex your current setup is. – Werner May 29 '15 at 20:44
  • identification of the \documentclass is absolutely necessary. different classes define this element in different ways, and unless we know what to look at, we're just spinning out wheels. – barbara beeton May 29 '15 at 20:49
  • Oh, sorry, didn't realize this. I try to cut out as much stuff as I can, and post it as an edit. – Maxim Moloshenko May 29 '15 at 20:50
1

Okay, so I trimmed your MWE to the point that it was, in fact, both minimal (no extraneous font information, formatting, and so forth) and working (it compiled without error). I'm not going to duplicate your formatting; but the principle here works.

It appears that, for your TOC, you want the word "Epilogue" to replace your chapter number (which you give in words); the below code will do that. It also places the word "Epilogue" and the name of the epilogue in the header, though it doesn't format the header the way yours does. (You may need to switch the arguments in \markboth to make this work for you; I didn't pay attention to which you want where.)

\documentclass[12pt,extrafontsizes,twoside,openright,final]{memoir}
\usepackage{lipsum}
\begin{document}
\tableofcontents*
\chapter{Once upon a time}
there was a princess (more text here, so that it is actually
at least 3 pages)
\renewcommand{\chaptername}{Epilogue}
\renewcommand{\thechapter}{Epilogue}
\makeatletter
\renewcommand{\@makechapterhead}[1]{%
    \markboth{Epilogue}{#1}%
    \vspace*{10pt}%
    \begin{center}%
    \LARGE%
    \chaptername%
    \vskip1em%
    \leavevmode#1%
    \end{center}%
    \vspace*{10\p@}%
}%
\makeatother
\chapter{Ending}
then she died (more text here, so that it is actually at
least 3 pages)\lipsum\lipsum
\end{document}

What this code does is, just before your epilogue, redefine \chaptername to be "Epilogue" (this makes it print "Epilogue" instead of "Chapter") and it redefines your chapter number to be "Epilogue", as well (this makes it print "Epilogue" instead of a chapter number in your TOC). It doesn't effect the chapter number itself, however, which internally is still the same.

It then redefines LaTeX's internal command \@makechapterhead, in ways that should be pretty transparent. You can fix this to be formatted however you like. Here's what this code gives you, though:

Epilogue in TOC Epilogue in Header

I think this is the general outline of what you're looking for. Hope that helps.

  • Should "Epilogue" and "Ending" both show up (and overlap) in the Table of Contents? – Mico May 30 '15 at 6:30
  • They should both show up, but not overlap; I just didn't duplicate his toc formatting. But those seem like the elements he wanted. – dgoodmaniii May 30 '15 at 8:43
  • Wow, this is amazing! Thank you so very much! I did some veeeeeery ugly things to save the formatting, but in the end your code was exactly the solution! – Maxim Moloshenko May 30 '15 at 15:07
0

Basically all you have to do is

\renewcommand{\chaptername}{\ignorespaces}
\renewcommand{\thechapter}{Epilogue}
\chapter{Ending}

since this is the last chapter in the document. The chapter counter will still be stepped, even though it's not necessary.

  • Won't this create an overlap of the words "Epilogue" and "Ending" in the ToC? – Mico May 30 '15 at 6:34
  • @Mico: The ToC prints the chapter number on a separate line, with the title underneath. So there should be no overlap. – Werner May 30 '15 at 13:50
  • Thanks for this explanation. I had failed to appreciate that the OP's ToC doesn't use a "standard" layout. – Mico May 30 '15 at 14:26

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.