I'm writing a document and I have a few chapter titles that I would like to appear as 2 lines for a chapter title, but only one line in the table of contents. Is there a simple command I to filter out the newline character like this?
Chapter Title
First Line:
Second more inform开发者_开发百科ative line
ToC:
First Line: Second more informative line
you can define alternative chapter titles for the toc:
\chapter[toc title]{regular title}
Building on second's answer above -- adding another answer so I can format the code nicely.
If you want, you can even make your own command. Something like this:
\newcommand{\twolineChapter}[2]{ %
\chapter[#1: #2]{#1: \\ #2} %
}
Then write in your document's body
\twolineChapter{First Line}{Second more informative line}
Which, when you typeset your book, will get turned into
\chapter[First Line: Second more informative line]{First Line: \\ Second more informative line}
This is especially nice if you later decide to change how titles are formatted, for example putting the subtitle in a smaller font.
精彩评论