Text FormattingLine Break in Chapter Heading but not in ToC Entry

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gwydion
Posts: 12
Joined: Thu Feb 09, 2012 1:50 pm

Line Break in Chapter Heading but not in ToC Entry

Post by gwydion »

Hi!

Well, I have this simple issue (or at least, I think it is) that i have not figured it out how to solve.

For my convenience, I need a line break the title of one chapter,i.e., I have something like \chapter{line 1 \\ line 2}. However, this is how is going to render in the table of contents

Code: Select all

line 1
line 2 ........... xx
Is there any form to prevent this? I had to change manually the headers of this chapter to avoid this, but no luck with the table of contents.

Thx

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

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Line Break in Chapter Heading but not in ToC Entry

Post by Stefan Kottwitz »

Just use the optional argument of \chapter, which affects both table of contents and header entry:

Code: Select all

\chapter[line 1 line 2]{line 1 \\ line 2}
Stefan
LaTeX.org admin
gwydion
Posts: 12
Joined: Thu Feb 09, 2012 1:50 pm

Re: Line Break in Chapter Heading but not in ToC Entry

Post by gwydion »

*facepalm*

D'oh! How did I miss that?!

Thanks, Stefan_K
Post Reply