【发布时间】:2021-04-15 10:21:18
【问题描述】:
我有以下test.md:
---
listings: true # here it just seems to include usepackage, but still keeps code blocks in {verbatim}; only --listings on command line starts wrapping code block in lstlisting ?
title: "Some title here"
author: John Doe
date: \today
---
# Introduction
Here is some code output, obtained with the `devcon.exe` command line tool:
```
PCI\VEN_8086&DEV_A295&SUBSYS_36E217AA&REV_F0\3&11583659&0&E0
Name: Intel(R) 200 Series Chipset Family PCI Express Root Port #6 - A295
Driver is running.
PCI\VEN_8086&DEV_5912&SUBSYS_36E217AA&REV_04\3&11583659&0&10
Name: Intel(R) HD Graphics 630
Driver is running.
ACPI\ACPI000C\2&DABA3FF&1
Name: ACPI Processor Aggregator
Driver is running.
```
So ...
所以,如果我按原样使用 pandoc 构建这个,代码块 仍然 包裹在 {verbatim} 环境中,即使包含 \usepackage{listings},因为存在 listings: true在 YAML 标头中:
$ pandoc test.md -s -o test.tex && grep '\\begin\|list' test.tex
\usepackage{listings}
\providecommand{\tightlist}{%
\begin{document}
\begin{verbatim}
仅当我将--listings 开关添加到命令行时,我才会将代码块包装在{lstlistings} 环境中:
$ pandoc test.md --listings -s -o test.tex && grep '\\begin\|list' test.tex
\usepackage{listings}
\providecommand{\tightlist}{%
\begin{document}
\begin{lstlisting}
\end{lstlisting}
我的问题是:有什么方法可以在 YAML 标头中指定使用 listingsonly -- 无需 必须使用 --listings在命令行中切换pandoc调用?
编辑:这是在 pandoc 2.11.4
【问题讨论】: