使用Pandoc保留标题中的换行符 [英] Preserve line breaks in title using pandoc
问题描述
在pandoc风格的Markdown中考虑以下标题栏:
Consider the following title block in pandoc-flavored Markdown:
% Higgelty Pigglety Pop!
or
There Must Be More to Life
% Maurice Sendak
在这里,换行符是标题的一部分.可以重新设置标题格式,以便将其插入常规文本流,例如"Higgelty Pigglety Pop!或者,必须有更多的生命",但是在文档的标题页上没有谈论但要使用换行符时,保留换行符至关重要.根据样式,它可能看起来像这样:
Here, line breaks are part of the title. It is possible to reformat the title in order to insert it into regular text flow, e.g. "Higgelty Pigglety Pop! Or, There Must Be More to Life", but when not talked about but used on the title page of a document, preserving the line breaks is crucial. Depending on the style, it might look like this:
Higgelty Pigglety Pop!
or
There Must Be More to Life
Maurice Sendak
我的问题:如何在pandoc的输出中实现正确的多行标题显示?
My question: How can I achieve a proper multi-line title display in the output of pandoc?
便携式版本将是首选,但我也会对仅LaTeX的黑客感到满意.
A portable version would be preferred, but I'd also be content with a LaTeX-only hack.
推荐答案
% Higgelty Pigglety Pop! \
or \
There Must Be More to Life
% Maurice Sendak
Pandoc Markdown默认启用 escaped_line_breaks
扩展名:
Pandoc Markdown enables the escaped_line_breaks
extension by default:
反斜杠后跟换行符也是强行换行符.注意:在多行和网格表单元格中,这是创建硬断行的唯一方法,因为单元格中的尾部空格将被忽略.
A backslash followed by a newline is also a hard line break. Note: in multiline and grid table cells, this is the only way to create a hard line break, since trailing spaces in the cells are ignored.
这篇关于使用Pandoc保留标题中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!