Pandoc Markdown转换为Latex PDF:表格将行合并成一行吗?

时间:2020-07-10 13:36:42

标签: pdf latex markdown pandoc

请考虑以下示例test.md Markdown文件:

---
title: "Testing"
author: Bob Alice
date: July 07, 2010
geometry: margin=2cm
documentclass: extarticle
fontsize: 12pt
output: pdf_document
---

Here is a test of a table:

+----------+-------------------+-----------------+
| Box name | Another parameter |  The IP address |
+==========+===================+=================+
| Test 1   | random-string-01  |       10.0.0.20 |
| Test 2   | random-string-02  |       10.0.0.30 |
+----------+-------------------+-----------------+

如果我通过pandoc进行转换:

$ pandoc --version
pandoc.exe 2.10 ...

...和:

pandoc test.md --pdf-engine=xelatex -o test.pdf

...结果是:

test.pdf

也就是说,“ Test 1”和“ Test 2”被压缩为一行-即使文档中关于grid_tables的信息是明确的:

https://pandoc.org/MANUAL.html#tables

Pandoc不支持具有行跨度或列跨度的网格表。这意味着Pandoc不支持行间可变列数和行间可变行数。所有网格表的每一行必须具有相同的列数,并且每一列必须具有相同的行数。

所以,我真的看不到它如何将这些行合并为一个。

是否可以获取pandoc-> Latex-> pdf,以将“ Test 1”和“ Test 2”保留在各自的单元格中?并有可能摆脱表格底部的空白垂直空间吗?

1 个答案:

答案 0 :(得分:3)

Grid tables使用明确的垂直线分隔行。其他单元格中存在换行符的事实是偶然的,因为内容不适合一行。

改为使用此:

+----------+-------------------+-----------------+
| Box name | Another parameter |  The IP address |
+==========+===================+=================+
| Test 1   | random-string-01  |       10.0.0.20 |
+----------+-------------------+-----------------+
| Test 2   | random-string-02  |       10.0.0.30 |
+----------+-------------------+-----------------+