【问题标题】:pandoc: Undefined control sequence \colorboxpandoc:未定义的控制序列 \colorbox
【发布时间】:2020-12-14 15:29:33
【问题描述】:

问题

我有一个包含 MarkdownLaTex 组合的文件,我想将其转换为 PDF。 Pandoc 似乎可以在 Ubuntu 20.04 中工作,但不能在 Debian 10 中工作。

我的安装

# Installing Pandoc and dependencies
apt-get install pandoc texlive-xetex texlive-latex-recommended

我的降价

我在一个名为 test.md 的文件中有以下文本:

\centerline{\Large{\textbf{Test 1}}}

\colorbox{blue!25}{\Large{\textbf{Test 2}}}

**This is a test**

转化

# Conversion
pandoc -V geometry:margin=0.7in -s test.md -o output.pdf

在 Ubuntu 20.04 中,我生成了一个漂亮的 PDF。
在 Debian 10 (Docker) 中,我收到以下错误:

! Undefined control sequence.
l.62 \colorbox

我是否缺少 Debian 10 中的一些依赖项?有没有办法查看默认使用的 Pandoc 引擎?我做错了什么?

当运行详细模式时,安装似乎使用不同的引擎,但是,当我指定几何驱动程序以使其相同时,问题仍然存在。

# Debian 10
*geometry* driver: auto-detecting
*geometry* detected driver: xetex

# Ubuntu 20.04
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex

更新:解决方法

阅读了几篇关于类似问题的帖子,我首先尝试将 \usepackage{xcolor} 添加到文档的开头,但这没有用。然后我发现你必须添加一个 YAML-header 然后它才能工作。然而,最初的问题仍然让我感到困惑。

# Adding this to the start of the document fixed the problem
---
header-includes:
  - \usepackage{xcolor}
output:
    pdf_document
---

【问题讨论】:

    标签: pdf debian latex markdown pandoc


    【解决方案1】:

    Debian 10 (buster) ships with pandoc 2.2.1,而 Ubuntu 20.04 (focal) comes with pandoc 2.5。您似乎遇到了一个已在更高版本中修复的错误。

    然而,这好奇。更改日志提到像这样的错误是fixed in version 2.6,它比您的任何一个版本都新。所以老实说,我对你触发的错误的确切性质有点困惑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-28
      • 1970-01-01
      • 1970-01-01
      • 2021-09-07
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      相关资源
      最近更新 更多