Page LayoutManual Line Break in optional ToC Entry for Chapter

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Stevenet
Posts: 13
Joined: Sun Oct 30, 2011 6:34 pm

Manual Line Break in optional ToC Entry for Chapter

Post by Stevenet »

I have a \part and a \chapter at back matter. The chapter title at index, needs a line jump, so:

Code: Select all

\chapter[the title \\ for index]{the title at chapter}
For any strange reason, PDFLaTeX was unable to compile and generate a PDF, if a put a \\ at this area (after \backmatter). I a leave the \\, there's no problem.

How can I solve this?

Steve,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Manual Line Break in optional ToC Entry for Chapter

Post by localghost »

Why do you need this manual intervention at all? Line breaks in ToC entries should be done automatically by default. If you could give us a minimal example, we would have a clear problem description and finding a solution would become much easier.


Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Manual Line Break in optional ToC Entry for Chapter

Post by Stefan Kottwitz »

Hi Steve,

perhaps protecting helps, i.e.

Code: Select all

\chapter[the title\protect\newline for index]{the title at chapter}
But generally try to provide more information regarding a problem, such as error messages and a code example, as Thorsten recommended.

Stefan
LaTeX.org admin
Stevenet
Posts: 13
Joined: Sun Oct 30, 2011 6:34 pm

Re: Manual Line Break in optional ToC Entry for Chapter

Post by Stevenet »

Hi,

My book has 2 prologues and some epilogues. Only for them, (not for the usual mainmatter chapters) i would an index TOC with 2 lines; The prologue name, and the autor of this prologue. So, for the prologues, i put a \\ inside the \chapter[the name at toc \\ by Steve]{The name at toc}...

The question was that, at backmatter (epilogues) the '\\' solution couldn't be done by this way (causes errors at pdflatex)... but yes!, coul be done (and is ok) putting the \protect\newline... So, thank you Stefan, for this tip!

Thanks everyone!

Steve,
umutayildiz
Posts: 2
Joined: Thu Apr 12, 2012 1:09 pm

Manual Line Break in optional ToC Entry for Chapter

Post by umutayildiz »

It is probably due to your hyperref package. In order to overcome this problem, you should simply add the following option to hyperref.

Code: Select all

\usepackage[linktocpage=true]{hyperref}
Post Reply