使用 Pandoc 参考数字和 table 数字

Reference to figure and table numbers with Pandoc

我正在尝试使用 Markdown/restructuredText 制作一个文档,然后使用 xelatex.

pandoc 转换为 PDF

我想return参考正文中的图表编号。

在 Markdown 和 reSt 标记语言中,交叉引用 return a link 到图而不是图号。

例如 [the figure](#myfig) with markdown 或 myfig_ with reST links to the figure but don't automatically update the figure number.

是否可以使用 Markdown 或 ReST 标记语言来引用图表编号?

我建议将 pandoc-crossref filter 与 pandoc 一起使用。 demo 让您对语法有一个很好的了解。您可以通过使用 --filter pandoc-crossref.

调用 pandoc 来调用它

pandoc-fignos and pandoc-tablenos filters from the pandoc-xnos 过滤器套件是在 markdown 中与 pandoc 交叉引用的不错选择。

要标记要编号的图形,请在其属性中添加标识符:

![Caption.](image.png){#fig:id}

要引用该图,请使用 @fig:id

同样,要标记一个table进行编号,为其属性添加一个标识符:

A B
- -
0 1

Table: Caption. {#tbl:id}

要引用 table,请使用 @tbl:id

处理markdown文档时,只需在pandoc命令中加上--filter pandoc-fignos --filter pandoc-tablenos即可。