【问题标题】:Pandoc: Long tablerows in Markdown->PDF documents do not get linewrapPandoc:Markdown-> PDF 文档中的长表格行没有换行
【发布时间】:2014-09-22 03:02:09
【问题描述】:

我正在使用 Pandoc 生成 markdown->包含大量表格的 DOCX 文档,但希望更好地控制布局。

我现在也在尝试输出 markdown->PDF,但遇到了表格输出问题。

在 DOCX 中,带有文本的长行被简单地分成多行。在 PDF 文档中,这不会发生;一行始终是单行,不会在右边距处换行,而是在页面之外继续。正常的段落文本根据右边距流动,所以问题可能不是页面大小。

示例降价:

This is text that flows according to the page limits. This is text that flows according to the page limits. This is text that flows according to the page limits. 
This is text that flows according to the page limits. This is text that flows according to the page limits. 

| Version | Date  | Comment |
|--------:|-------|---------|
| 1.0.0     | 07.04.2014 | This is a table row that does not flow with the page limits. This is a table row that does not flow with the page limits. |
| 2.0.0     | 07.04.2014 | This is a table row that does not flow with the page limits. This is a table row that does not flow with the page limits. |

This is text that flows according to the page limits. This is text that flows according to the page limits. This is text that flows according to the page limits. 
This is text that flows according to the page limits. This is text that flows according to the page limits. 

生成的 PDF

如何在 PDF 表格中启用换行?

【问题讨论】:

    标签: pdf-generation latex pandoc


    【解决方案1】:

    管道表不包含在 LaTeX/PDF 输出中。使用多行表或网格表,如pandoc User's Guide 中所述。这也可以让您控制列的相对宽度。

    【讨论】:

    • 非常感谢,文档提到“多行表允许标题和表行跨越多行文本”但我认为这是为了在 Markdown 源中启用多行,而不是在输出中。也许这可以更清楚,因为 HTML 和 DOCX 输出似乎无论如何都会这样做。
    • 是的,它可以更清楚。问题是,如果您希望单元格换行,LaTeX(与其他格式不同)需要明确指定列宽,并且该信息在所有内容都在一行上的管道表中不可用。
    • 我的表格在底部离开页面,超过了底部边距和页码。有没有办法确保表格在不使用分页符的情况下被推送到下一页?
    • 这似乎不再适用于 pandoc 2.7.3。生成的 (La)Tex 看起来不错(包括相对列宽,但生成的 PDF 将所有内容放在一行上。
    【解决方案2】:

    我不知道为什么,但它有效:

    pandoc --columns=10 src.md -o tgt.pdf
    

    (将列设置为非常小的值,然后为 72)管道表将换行。

    【讨论】:

    • 如果您还有其他问题,请提出新问题,而不是将其发布为答案 :)
    猜你喜欢
    • 2023-04-04
    • 2010-09-26
    • 1970-01-01
    • 2011-09-10
    • 2011-11-04
    • 1970-01-01
    • 2013-02-13
    • 2011-12-04
    • 1970-01-01
    相关资源
    最近更新 更多