首页 > 解决方案 > 使用 tufte-latex 包时未定义的控制序列

问题描述

我在一个全新的 bookdown 项目中有一个 pandoc 网格表:

# Hello bookdown 

All chapters start with a first-level heading followed by your chapter title, like the line above. There should be only one first-level heading (`#`) per .Rmd file.

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

bookdown::gitbook通过and渲染为 html 和普通 pdf很好,但是通过orbookdown::pdf_book渲染为 tufte 格式失败:tufte::tufte_bookbookdown::tufte_book2

! Undefined control sequence.
<argument> @{} >{\raggedright \arraybackslash 
                                              }p{(\columnwidth - 4\tabcolsep...
l.93 ...umnwidth - 4\tabcolsep) * \real{0.29}}@{}}

表结构与生成的其他表不同:

\begin{longtable}[]{@{}
  >{\raggedright\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.22}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.22}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.29}}@{}}
\toprule
Fruit & Price & Advantages \\
...

因此,我认为问题的根源在于tufte-latextufte_book 所依赖的包,但我无法进一步缩小范围。

文档的 tex 代码在这里- 罪魁祸首部分从第 96 行开始。

标签: latexr-markdownbookdown

解决方案


这是tufte包中的一个问题。

它现在已在开发版本 0.10.2 中修复,可以从 github 安装

remotes::install_github("rstudio/tufte")

下一个版本 0.11 将在 CRAN 上进行修复


推荐阅读