如何控制Pandoc/Markdown表格中的单元格宽度? [英] How can I control cell width in a Pandoc/Markdown table?
本文介绍了如何控制Pandoc/Markdown表格中的单元格宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法控制Pandoc表中的最大单元格宽度?
例如:
| | |
|----------|------------|
| I want to the contents of this cell to fit on one line| XXXXXXX |
我要控制左侧单元格中的行断开的方式,换言之,我要控制单元格的最大宽度。
推荐答案
{警告:此答案仅适用于Pandoc,并且仅在使用Markdown语法中输入的multiline_table扩展时适用。因此它不适用于Github风味降价(GFM)。}
多行表确实支持相对列宽。(但是,您将无法控制任何单元格中的行断开的确切位置和方式。)
请参阅我的answer to your other question。
请注意,这仅适用于LaTeX、PDF和HTML输出,但不一定适用于HTML、ODT、DOCX或其他输出.
更新
这里有一个示例,使用了三个不同的多行表示例。 它们的降价幅度因其表头/内容的宽度而异 关注分隔线:
-------------------------------------------------------------------- Column 1 Column 2 ------------------------------------------------------ ------------ I want the contents of this cell to fit into one line Word1 Word2 ------------------------------------------------------ ------------ : **Column 2 is narrow.** For column 1: 54 dashes in Markdown source for separator line; for column 2: 12 dashes in separator line (22% of column 1). -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Column 1 Column 2 ------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------ I want the contents of this cell to fit into one line Word1 Word2 ------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------ : **Column 1 is narrow.** For column 1: 54 dashes in Markdown source for separator line; for column 2: 162 dashes in separator line (300% of column 1). ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Column 1 Column 2 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------- I want the contents of this cell to fit into one line Word1 Word2 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------- : **Column 2 is even narrower than in Table 1.** For column 1: 210 dashes in Markdown source for separator line; for column 2: 15 dashes in separator line (7% of column 1).
结果
PDF
HTML(未使用大量样式表)
这篇关于如何控制Pandoc/Markdown表格中的单元格宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文