Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to define a chapter outside of any part in a book?

326 views
Skip to first unread message

Peter Chapin

unread,
Jul 13, 2014, 8:13:05 AM7/13/14
to
I'm writing a novel using LaTeX. I have a prologue and an epilogue. The
main text is divided into three parts, each with several chapters. I'm
using the standard book document class and following this structure:

\chapter{Prologue}
\part{First Part}
\chapter{First Chapter}
\chapter{Second Chapter}
\part{Second Part}
\chapter{Third Chapter}
\chapter{Forth Chapter}
\part{Third Part}
\chapter{Fifth Chapter}
\chapter{Sixth Chapter}
\chapter{Epilogue}

This is fine but the problem is in the table of contents the Epilogue is
shown as being under the last part. This isn't surprising since it looks
like any other chapter. What I want, however, is for the Epilogue to
appear at the same level as the part headings in the TOC, just as the
Prologue does. I need some way to "terminate" the processing of Part III
so the Epilogue chapter is raised to the top level.

In case it matters I also have

\setcounter{secnumdepth}{-1}

in the document preamble to suppress chapter numbering.

Thanks for any advice you can give!

Peter

Robert Heller

unread,
Jul 13, 2014, 9:10:31 AM7/13/14
to
I faced a *similar* issue with a multi-part user manual that had bibliography
and index at the end, but did not want the bibliography and index to be under
the last 'part'. What I did was redefine the thebibliography environment and
the theindex environment and changed how the \addcontentsline{} macros were
called:

\chapter*{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\addcontentsline{toc}{part}{\bibname}

..

\twocolumn[\@makeschapterhead{\indexname}]%
\@mkboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\addcontentsline{toc}{part}{\indexname}

Basically, I just made the TOC lines for the back matter (bibliography and
index) to be at the 'part' level in the TOC. This takes them out from under
the last part.

My guess is that what you want is something like this:

\chapter*{Prologue}
\markboth{Prologue}{Prologue}
\addcontentsline{toc}{part}{Prologue}
\part{First Part}
\chapter{First Chapter}
\chapter{Second Chapter}
\part{Second Part}
\chapter{Third Chapter}
\chapter{Forth Chapter}
\part{Third Part}
\chapter{Fifth Chapter}
\chapter{Sixth Chapter}
\chapter*{Epilogue}
\markboth{Epilogue}{Epilogue}
\addcontentsline{toc}{part}{Epilogue}

I'm presuming that you probably don't want the Prologue and Epilogue to have
chapter numbers anyway, so using \chapter*{} probably makes sense. \chapter*{}
does NOT add a contents line or running headers and does not increment the
chapter number counter.

If this is NOT what you want, you can create a .sty file by copying the
\chapter{} command from the book class code and renaming it (eg
\chapteroutsidepart{}) and changing the 'guts', specifically changing the
\addcontentsline that is inside to use 'part' instead of 'chapter'.


>
> Peter
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Axel Berger

unread,
Jul 13, 2014, 4:13:48 PM7/13/14
to
Peter Chapin wrote:
> I need some way to "terminate" the processing of Part III
> so the Epilogue chapter is raised to the top level.
> ... to suppress chapter numbering.

As you don't use numbering, it might be that the command \appendix will
do the trick.

Axel

Peter Flynn

unread,
Jul 13, 2014, 7:19:22 PM7/13/14
to
On 07/13/2014 01:13 PM, Peter Chapin wrote:
> I'm writing a novel using LaTeX. I have a prologue and an epilogue. The
> main text is divided into three parts, each with several chapters. I'm
> using the standard book document class and following this structure:
>
> \chapter{Prologue}
> \part{First Part}
> \chapter{First Chapter}
> \chapter{Second Chapter}
> \part{Second Part}
> \chapter{Third Chapter}
> \chapter{Forth Chapter}
> \part{Third Part}
> \chapter{Fifth Chapter}
> \chapter{Sixth Chapter}
> \chapter{Epilogue}
>
> This is fine

Only because you're suppressing chapter numbers. Risky should you ever
change it, because your First Chapter will be numbered 2. You need to
add \setcounter{chapter}{0} immediately after \part{First Part}.

> but the problem is in the table of contents the Epilogue is
> shown as being under the last part. This isn't surprising since it looks
> like any other chapter. What I want, however, is for the Epilogue to
> appear at the same level as the part headings in the TOC, just as the
> Prologue does.

I'm not sure I understand what you mean by "at the same level". If you
want the Prologue and Epilogue formatted at Part level then they either
need to be done using \part, or faked by doing it manually:

\part*{Prologue}
\addcontentsline{toc}{part}{Prologue}

(that will be unnumbered, which is probably correct, as neither a
prologue nor an epilogue are chapters or parts, and should not be
numbered at all.

> I need some way to "terminate" the processing of Part III
> so the Epilogue chapter is raised to the top level.

This has been a matter of close attention from document engineers for
several decades :-)

In fact, if you are only concerned about the appearance of the ToC (and
not about the real nature of the entry), all you need is some extra space:

\chapter{Sixth Chapter}
your stuff
\addtocontents{toc}{\bigskip}
\chapter{Epilogue}

> In case it matters I also have
>
> \setcounter{secnumdepth}{-1}
>
> in the document preamble to suppress chapter numbering.

Yes, that did matter significantly :-) It's always best to give a
fully-working MINIMAL example, not random extracts that you think might
be relevant, so that we can just copy it and run it.

///Peter
--
XML FAQ: http://xml.silmaril.ie/


Axel Berger

unread,
Jul 13, 2014, 9:37:29 PM7/13/14
to
Peter Flynn wrote:
> \chapter{Sixth Chapter}
> your stuff
> \addtocontents{toc}{\bigskip}
> \chapter{Epilogue}

In case those chapters are included, as most are in practice, then
counterintuitatively all the extra stuff needs to get moved up one:

\include{Fifth Chapter}
\addtocontents{toc}{\bigskip}
\include{Sixth Chapter}
\include{Epilogue}

It's a funny old world.

Axel

Robert Heller

unread,
Jul 13, 2014, 10:41:59 PM7/13/14
to
I expect this will cause a *different* problem: \part*{} generates a very
*different* sort of 'heading' in the body of the work than \chapter*{}. The OP
really wants \chapter*{Prologue} and \addcontentsline{toc}{part}{Prologue}.
(Ditto for the Epilogue.) He probably wants the Prologue and Epilogue to look
like 'chapters', in the *body* of the work, but like 'parts' in the TOC. Since
he does NOT want chapter numbers, he could just use \chapter*{} everywhere,
but then he will need his own \addcontentsline and possibly \markboth macro
calls, since the \chapter* macro does not include these calls.

>
> (that will be unnumbered, which is probably correct, as neither a
> prologue nor an epilogue are chapters or parts, and should not be
> numbered at all.
>
> > I need some way to "terminate" the processing of Part III
> > so the Epilogue chapter is raised to the top level.
>
> This has been a matter of close attention from document engineers for
> several decades :-)
>
> In fact, if you are only concerned about the appearance of the ToC (and
> not about the real nature of the entry), all you need is some extra space:
>
> \chapter{Sixth Chapter}
> your stuff
> \addtocontents{toc}{\bigskip}
> \chapter{Epilogue}
>
> > In case it matters I also have
> >
> > \setcounter{secnumdepth}{-1}
> >
> > in the document preamble to suppress chapter numbering.
>
> Yes, that did matter significantly :-) It's always best to give a
> fully-working MINIMAL example, not random extracts that you think might
> be relevant, so that we can just copy it and run it.
>
> ///Peter

--
Robert Heller -- 978-544-6933 / hel...@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments



Peter Chapin

unread,
Jul 14, 2014, 8:09:29 AM7/14/14
to

Thanks for all the suggestions!

On 2014-07-13 22:41, Robert Heller wrote:

>> \part*{Prologue}
>> \addcontentsline{toc}{part}{Prologue}
>
> I expect this will cause a *different* problem: \part*{} generates a very
> *different* sort of 'heading' in the body of the work than \chapter*{}. The OP
> really wants \chapter*{Prologue} and \addcontentsline{toc}{part}{Prologue}.
> (Ditto for the Epilogue.) He probably wants the Prologue and Epilogue to look
> like 'chapters', in the *body* of the work, but like 'parts' in the TOC. Since
> he does NOT want chapter numbers, he could just use \chapter*{} everywhere,
> but then he will need his own \addcontentsline and possibly \markboth macro
> calls, since the \chapter* macro does not include these calls.

I ultimately ended up just using this in the Epilogue:

\chapter*{Epilogue}
%\markboth{Epilogue}{Epilogue}
\addcontentsline{toc}{part}{Epilogue}

The use of \markboth didn't appear to have any (visible) effect one way
or the other. What does \markboth do? I understand what I'm doing here
is suppressing the addition of "Epilogue" to the TOC under Part III (the
purpose of \chapter*) and then explicitly adding Epilogue to the TOC at
the part level. That makes sense to me.

Actually the handling of chapters in this work is a bit unusual. For one
thing they are not numbered sequentially. Secondly in my genre it is
traditional for chapters to have names that are just numbers without
"Chapter" or any other adornment. To obtain this effect I suppressed
chapter numbering with \setcounter{secnumdepth}{-1} and then just give
the chapters names that are numbers such as

\chapter{11}

This does mean I have to manually renumber the chapters when and if I
reorder them but at this point in the work that is a rare event. Since
the chapters aren't numbered sequentially anyway a certain amount of
tricky magic is necessary regardless.

Peter

Robert Heller

unread,
Jul 14, 2014, 9:25:03 AM7/14/14
to
At Mon, 14 Jul 2014 08:09:29 -0400 Peter Chapin <PCh...@vtc.vsc.edu> wrote:

>
>
> Thanks for all the suggestions!
>
> On 2014-07-13 22:41, Robert Heller wrote:
>
> >> \part*{Prologue}
> >> \addcontentsline{toc}{part}{Prologue}
> >
> > I expect this will cause a *different* problem: \part*{} generates a very
> > *different* sort of 'heading' in the body of the work than \chapter*{}. The OP
> > really wants \chapter*{Prologue} and \addcontentsline{toc}{part}{Prologue}.
> > (Ditto for the Epilogue.) He probably wants the Prologue and Epilogue to look
> > like 'chapters', in the *body* of the work, but like 'parts' in the TOC. Since
> > he does NOT want chapter numbers, he could just use \chapter*{} everywhere,
> > but then he will need his own \addcontentsline and possibly \markboth macro
> > calls, since the \chapter* macro does not include these calls.
>
> I ultimately ended up just using this in the Epilogue:
>
> \chapter*{Epilogue}
> %\markboth{Epilogue}{Epilogue}
> \addcontentsline{toc}{part}{Epilogue}
>
> The use of \markboth didn't appear to have any (visible) effect one way
> or the other. What does \markboth do? I understand what I'm doing here
> is suppressing the addition of "Epilogue" to the TOC under Part III (the
> purpose of \chapter*) and then explicitly adding Epilogue to the TOC at
> the part level. That makes sense to me.

\markboth deals with running page headers and depends on what sort of page
headings you have set up. Many books will include the chapter name and the
page number at the top of every page. If the Epilogue and Prologue are only
one page, or if you have selected a bare page style, \markboth will have no
visible effect. I'm guessing you have selected a \pagestyle{} that does not
include running headers.

\chapter*{} does *several* things differently from \chapter{}:

1) It does not increment the chapter counter.
2) It does not use the chapter counter.
3) It does not use \chaptername
4) It does not automagically do a \markboth
5) It does not include an \addcontentsline call

\chapter* is *normally* used for things like Prefaces or Introductions or
Acknowlments, and other non-chapter chapter-like things, either at the
beginning or the end, that occure outside of the normal chapter sequence. A
prologue and an epilogue are *exactly* this sort of thing.

>
> Actually the handling of chapters in this work is a bit unusual. For one
> thing they are not numbered sequentially. Secondly in my genre it is
> traditional for chapters to have names that are just numbers without
> "Chapter" or any other adornment. To obtain this effect I suppressed
> chapter numbering with \setcounter{secnumdepth}{-1} and then just give
> the chapters names that are numbers such as
>
> \chapter{11}
>
> This does mean I have to manually renumber the chapters when and if I
> reorder them but at this point in the work that is a rare event. Since
> the chapters aren't numbered sequentially anyway a certain amount of
> tricky magic is necessary regardless.

Ok, you really should be using \chapter*{11} and 'manually' including
\addcontentsline{toc}{chapter}{11}:

\chapter*{11}
\addcontentsline{toc}{chapter}{11}

This *reduces* the trickynesses you have to deal with and generally simplifies
thigs.

In other words, \chapter* already does 90% of the trickynesses you want to do
all on its own, without having to play additional games. The only missing bit
is the TOC handling, which is easy enough to deal with. (You might want to
define a macro:

\newcommand\mychapter[1]{%
\chapter*{#1}
\addcontentsline{toc}{chapter}{#1}}

Then

\mychapter{11}

will do what you want.

)

Ulrich D i e z

unread,
Jul 14, 2014, 10:27:47 AM7/14/14
to
Peter Chapin wrrote:

> This is fine but the problem is in the table of contents the Epilogue is
> shown as being under the last part. This isn't surprising since it looks
> like any other chapter. What I want, however, is for the Epilogue to
> appear at the same level as the part headings in the TOC, just as the
> Prologue does. I need some way to "terminate" the processing of Part III
> so the Epilogue chapter is raised to the top level.

What about hyperref-functionality requiring correctly adjusted
bookmark-levels and the setting of unique anchor-names in
pdf-files?

Ulrich
0 new messages