r - 预订!未定义的控制序列。\直通
问题描述
我发现当使用pandoc --listings
, 来渲染带有乳胶列表包的代码块时,它会改变字符,正如github所说,这是一个错误。所以 pandoc 引入\passthrough
了处理它。
我决定将我的 pandoc 更新到最新的 2.2.1 版本。但它会弹出这样的错误,
! Undefined control sequence.
<recently read> \passthrough
我想可能是因为listings
包太旧而没有\passthrough
. 所以我更新到 texlive 2018。它仍然有这个问题。我在https://github.com/rstudio/bookdown/issues/591提交了这个问题
我搜索了一些结果,
但没有人能解决。有什么建议吗?谢谢你。
我想我应该自己添加这个命令。texupdate 太慢了。
解决方案
此问题与您的 LaTeX 发行版无关,因此无需重新安装或更新 LaTeX。
如果在命令行中使用了标志,Pandoc 2.x 将逐字输入\passthrough{}
定义在
https://github.com/jgm/pandoc-templates/blob/052428151/default.latex#L169中。--listings
$ echo '`text`' | pandoc -f markdown -t latex --listings
\passthrough{\lstinline!text!}
一些可能的解决方案(从最简单到最难):
将选项设置
template
为null
inbookdown::pdf_book
,即bookdown::pdf_book: template: null
这意味着使用 Pandoc 的内置 Pandoc 模板,该模板定义了
\passthrough
.安装rmarkdown :的开发版本
devtools::install_github('rstudio/rmarkdown')
,我在其中添加了命令。\passthrough
在自定义 Pandoc LaTeX 模板(https://bookdown.org/yihui/bookdown/templates.htmltemplate
)中定义命令,并通过bookdown::pdf_book()
.
推荐阅读
- angular - 错误:(gcloud.builds.submit)HTTPError 403:存储桶“项目名称”的帐户尚未启用计费
- c++ - 我可以将什么用作 RAII+关注点分离的标准 C++ 基类
- javascript - 它是获取多个api的正确方法吗
- python - 错误:列表索引必须是整数或切片,而不是 str
- python - 如何使用 Python 从较大的列表中创建一个小的随机列表
- azure-iot-hub - Azure iot-hub 设备孪生 json 格式
- python-3.x - 使用 Python 将字符插入字符串
- python - 将数据帧附加到 sqlite3 表,BLOB 而不是时间戳
- css - css - 图标字体在本地显示图标,一些图标未显示在已发布的站点上
- entity-framework - 将连接字符串传递给 JetEntityFramework