LaTeX 错误:环境 ThreePartTable 未定义 [英] LaTeX Error: Environment ThreePartTable undefined
问题描述
我正在尝试在 RStudio 中使用 apa_table()
、Papaja 和 RMarkdown 创建一个表.每当我在 apa_table
函数中包含 longtable
时,我都会收到错误:
I am trying to create a table using apa_table()
, Papaja, and RMarkdown in RStudio. Whenever I include longtable
in the apa_table
function, I get the error:
<代码>!LaTeX 错误:未定义环境 ThreePartTable.
奇怪的是,产生的错误日志包括:
Strangely, the error log that's produced includes:
(/home/tim/.TinyTeX/texmf-dist/tex/latex/threeparttable/threeparttable.sty
Package: threeparttable 2003/06/13 v 3.0
和
包标题信息:已加载三部分包.
注意错误和加载的包之间的不同大小写,这让我怀疑这是否是问题所在.
Note the different capitalization between the error and the loaded package, which makes me wonder if that's the issue.
请注意,这与之前的问题中报告的错误相同:!LaTeX 错误:环境三部分未定义.但是,那里提供的解决方案对我不起作用.
Note that this is the same error as reported in an earlier question: ! LaTeX Error: Environment threeparttable undefined. However, the solution provided there does not work for me.
我不确定这是否可以在我的特定设置之外重现,但这里有一些代码会给我带来问题.
I'm not sure if this will be reproducible outside of my particular setup, but here is some code that produces the problem for me.
请注意,如果我只是使用 kable()
(也包括在下面),我不会遇到同样的问题.
Note that I do not have the same issue if I simply use kable()
(also included below).
---
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}
library("papaja")
library("knitr")
library("kableExtra")
```
```{r, results="asis"}
kable(mtcars, 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()
的输出,以防万一:
Here is the output from sessionInfo()
in case it helps:
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
推荐答案
ThreePartTable
环境需要 threeparttablex
样式.原则上 papaja
尝试加载这种样式,但似乎与最近的 rmarkdown
不兼容.由于这似乎是 rmarkdown
中的回归,我打开了一个问题 为它.作为解决方法,您可以降级到 rmarkdown
的旧版本.同时,您也可以从 GitHub 安装固定版本:remotes::install_github('rstudio/rmarkdown')
.
You need the threeparttablex
style for the ThreePartTable
environment. In principle papaja
tries to load this style, but there seems to be an incompatibility with recent rmarkdown
. Since this seems to be a regression in rmarkdown
, I have opened an issue for it. As a workaround you can downgrade to an older version of rmarkdown
. Meanwhile, you can also install a fixed version from GitHub: remotes::install_github('rstudio/rmarkdown')
.
这篇关于LaTeX 错误:环境 ThreePartTable 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!