如何在 Pandoc 的 front matter 中指定编号的部分? [英] How to specify numbered sections in Pandoc's front matter?

查看:22
本文介绍了如何在 Pandoc 的 front matter 中指定编号的部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 Pandoc 对 YAML 前端的支持来指定编号的部分.我知道命令行使用的标志是 --number-sections,但类似于

I would like to specify numbered sections via Pandoc's support for YAML front matter. I know that the flag for the command-line usage is --number-sections, but something like

---
title: Test
number-sections: true
---

不会产生预期的结果.我知道我很接近,因为您可以使用几何包(例如 geometry: margin=2cm)来做到这一点.我希望有一个关于如何处理 Pandoc YAML 前端问题的权威指南.例如,以下内容非常有用(避免使用模板),但它的可发现性很低:

doesn't produce the desired result. I know that I am close because you can do this with the geometry package (e.g. geometry: margin=2cm). I wish there was a definitive guide on how Pandoc YAML front matter handling. For example, the following is very useful (avoids templates), but its discoverability is low:

 header-includes: 
 - usepackage{some latex package}

推荐答案

为了在 Latex 输出中打开编号部分,您需要在 YAML 块中使用 numbersections.如果你想用 pandoc 来发现"这样的东西,只需浏览模板:

In order to turn on numbered-sections in latex output you need to use numbersections in your YAML block. If you ever want to "discover" things like this with pandoc just poke around the templates:

 $ grep -i number default.latex
 $if(numbersections)$
 $ grep -i number default.html*
 $

如您所见,此选项不适用于 html.

As you can see this option does not work with html.

我测试过的 Markdown 和 YAML:

Markdown and YAML I tested with:

 ---
 title: Test
 numbersections: true
 ---


 # blah

 Text is here.

 ## Double Blah

 Twice the text is here

如果您需要它使用的不仅仅是 beamer、latex、context、opendoc,您需要在 github 上提交一个错误.

If you need it to work with more than beamer,latex,context,opendoc you will need to file a bug at github.

这篇关于如何在 Pandoc 的 front matter 中指定编号的部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆