Latex 中将换行符转换为空格
我正在编写一份文档,并且有几个章节标题,我希望将其显示为两行章节标题,但在目录中仅显示一行。有没有一个简单的命令可以过滤掉这样的换行符?
章节标题
第一行:
第二行信息更丰富
ToC:
第一行:第二行提供更多信息
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 informative line
ToC:
First Line: Second more informative line
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
您可以为目录定义替代章节标题:
you can define alternative chapter titles for the toc:
基于上面第二个答案——添加另一个答案,这样我就可以很好地格式化代码。
如果需要,您甚至可以发出自己的命令。像这样的事情:
然后在文档正文中写入
,当您排版书籍时,它会变成这样,
如果您后来决定更改标题的格式(例如将副标题设置为较小的字体),这尤其好。
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:
Then write in your document's body
Which, when you typeset your book, will get turned into
This is especially nice if you later decide to change how titles are formatted, for example putting the subtitle in a smaller font.