我正在尝试使用RStudio中的apa_table()
、Papaja和RMarkdown创建一个表。每当我在apa_table
函数中包含longtable
时,我都会得到以下错误:
! LaTeX Error: Environment ThreePartTable undefined.
奇怪的是,生成的错误日志包括:
(/home/tim/.TinyTeX/texmf-dist/tex/latex/threeparttable/threeparttable.sty
Package: threeparttable 2003/06/13 v 3.0
和
Package caption Info: threeparttable package is loaded.
注意错误和加载的包之间的不同大小写,这让我想知道这是不是问题所在。
请注意,这与前面的问题中报告的错误相同:! LaTeX Error: Environment threeparttable undefined。然而,那里提供的解决方案对我不起作用。
我不确定这是否会在我的特定设置之外重现,但这里有一些为我产生问题的代码。
请注意,如果我简单地使用kable()
(也包括在下面),我就不会遇到同样的问题。
---
title : "The title"
shorttitle : "Title"
author:
- name : "First Author"
affiliation : "1"
corresponding : yes # Define only one corresponding author
address : "Postal address"
email : "my@email.com"
- name : "Ernst-August Doelle"
affiliation : "1,2"
affiliation:
- id : "1"
institution : "Wilhelm-Wundt-University"
- id : "2"
institution : "Konstanz Business School"
authornote: |
abstract: |
keywords : "keywords"
wordcount : "X"
floatsintext : no
figurelist : no
tablelist : no
footnotelist : no
linenumbers : yes
mask : no
draft : no
tables : yes
documentclass : "apa6"
classoption : "man"
output : papaja::apa6_pdf
---
```{r setup, include = FALSE}
库(“papaja”)
库(“knitr”)
库(“kableExtra”)
```{r, results="asis"}
kable(mtcar,longtable=TRUE)
```{r, results="asis"}
apa_table(mtcars,longtable=TRUE)
\begingroup
\setlength{\parindent}{-0.5in}
\setlength{\leftskip}{0.5in}
<div id = "refs"></div>
\endgroup
以下是sessionInfo()
的输出,以防万一:
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.2
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 digest_0.6.23 crayon_1.3.4 withr_2.1.2 assertthat_0.2.1 evaluate_0.14 rlang_0.4.2
[8] cli_1.1.0 rstudioapi_0.10 rmarkdown_1.18 tools_3.6.1 xfun_0.11 yaml_2.2.0 compiler_3.6.1
[15] sessioninfo_1.1.1 papaja_0.1.0.9842 htmltools_0.4.0 knitr_1.26
发布于 2019-12-09 19:05:44
对于ThreePartTable
环境,您需要使用threeparttablex
样式。原则上,papaja
尝试加载此样式,但似乎与最近的rmarkdown
不兼容。由于这在rmarkdown
中似乎是一种回归,因此我为它打开了an issue。作为一种解决办法,您可以降级到旧版本的rmarkdown
。同时,你也可以从GitHub安装一个修复的版本:remotes::install_github('rstudio/rmarkdown')
。
https://stackoverflow.com/questions/59245638
复制相似问题