【问题标题】:Pandoc sourcecode block with figure caption带有图形标题的 Pandoc 源代码块
【发布时间】:2017-03-06 20:54:24
【问题描述】:

当 pandoc 从 markdown 文件生成 pdf 时,所有图像都在浮动块中获得了标题(图 1:一些标题)。

如何对源代码做同样的事情?

如果可能,我想保留生成 HTML 的选项,并且不使用 Latex 特定命令。

想象的输入:

```bash {caption: "A git commit"}
git commit file1.txt --message="A commit message"
```

输出:

git commit file1.txt --message="A commit message"

图 1:一个 git 提交

【问题讨论】:

  • 如果您可以为您的受众提供一个可以复制您当前行为的示例文档,那将是理想的选择。
  • Pandoc 提供了这些数字 only for images。但是,您可以写一个pandoc filter 来做您想做的事...

标签: latex markdown pandoc


【解决方案1】:

你可以像这样使用Fenced code blocks

~~~ { .bash caption="A git commit"}
git commit file1.txt --message="A commit message"
~~~

另外请注意,您需要将 pandoc 与 --listing 一起使用才能使其正常工作。

来源

【讨论】:

    猜你喜欢
    • 2013-01-14
    • 2018-09-17
    • 2013-09-02
    • 2012-01-18
    • 2018-09-10
    • 1970-01-01
    • 2016-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多