我希望在用thesisdow包创建的文档中使用huxtable包创建表。编织到HTML很好地工作与html。但是,在加载huxtable之后,一旦包含了一个表,编织但PDF就会失败,并出现以下错误:
! LaTeX Error: Environment threeparttable undefined.在后台,似乎与LaTex包发生了冲突。在MWE的下面是关于index.file的。有趣的是,在一个简单的标记文件编织到html和PDF都没有问题。由于下标是建立在预订之上的,所以在将预订文件编成PDF时也可能会发生错误。
index.Rmd
---
knit: "bookdown::render_book"
site: bookdown::bookdown_site
output:
thesisdown::thesis_pdf: default
# thesisdown::thesis_gitbook: default
---
```{r include_packages, include = FALSE}
# Ensure that the thesisdown package is installed and loaded
if(!require(devtools))
install.packages("devtools", repos = "http://cran.rstudio.com")
if(!require(thesisdown))
devtools::install_github("ismayc/thesisdown")
library(thesisdown)
```
# Random Test Output - *before* calling "library(huxtable)"
a table with pressure data
```{r pressure-table, echo=FALSE}
pressure
```
```{r echo=FALSE}
library(huxtable)
```
# Random Test Output - *after* calling "library(huxtable)"
a table with pressure data
```{r pressure-table2, echo=FALSE}
pressure
```MWE摘要:
更新:
(1)如果按照@dash2 2的建议,在YAML-header中使用huxtable所需的LaTex包,则可以使用该方法。
(2)然而,如果与哈士金合作,不幸的是,问题仍然存在。
1. index.Rmd (thesisdown)
---
knit: "bookdown::render_book"
site: bookdown::bookdown_site
output:
thesisdown::thesis_pdf: default
# thesisdown::thesis_gitbook: default
header-includes:
- \usepackage{array}
- \usepackage{caption}
- \usepackage{graphicx}
- \usepackage{siunitx}
- \usepackage{colortbl}
- \usepackage{multirow}
- \usepackage{hhline}
- \usepackage{calc}
- \usepackage{tabularx}
- \usepackage{threeparttable}
- \usepackage{wrapfig}
---
...2. index.Rmd (哈士克羽绒)
---
# UW thesis fields
title: "My thesis title - edit in index.Rmd"
author: "My Name"
year: "2017"
program: "My Department"
chair: "Name of my committee chair"
chairtitle: "Title of my chair"
signature1: "person 1"
signature2: "person 2"
signature3: "person 3"
abstract: |
"Here is my abstract"
acknowledgments: |
"My acknowledgments"
dedication: |
"My dedication"
knit: "bookdown::render_book"
site: bookdown::bookdown_site
output:
huskydown::thesis_pdf:
latex_engine: xelatex
bibliography: bib/thesis.bib
csl: csl/apa.csl
lot: true
lof: true
header-includes:
- \usepackage{tikz}
- \usepackage{array}
- \usepackage{caption}
- \usepackage{graphicx}
- \usepackage{siunitx}
- \usepackage{colortbl}
- \usepackage{multirow}
- \usepackage{hhline}
- \usepackage{calc}
- \usepackage{tabularx}
- \usepackage{threeparttable}
- \usepackage{wrapfig}
---
```{r include_packages, include = FALSE}
# This chunk ensures that the huskydown package is
# installed and loaded. This huskydown package includes
# the template files for the thesis.
if(!require(devtools))
install.packages("devtools", repos = "http://cran.rstudio.com")
if(!require(huskydown))
devtools::install_github("benmarwick/huskydown")
library(huskydown)
```
# Random Test Output - *before* calling "library(huxtable)"
a table with pressure data
```{r pressure-table, echo=FALSE}
pressure
```
```{r echo=FALSE}
library(huxtable)
```
# Random Test Output - *after* calling "library(huxtable)"
a table with pressure data
```{r pressure-table2, echo=FALSE}
pressure
```尽管加载了LaTex包,但是编织用于哈士基向下的index.Rmd仍然会引发错误:
! LaTeX Error: Environment threeparttable undefined.是否任何带有LaTex的header-includes包都可能被huskydown忽略?
发布于 2020-02-04 09:01:21
@dash2 2推荐的解决方案:手动包含LaTex包
"LaTex包装载了header-includes,被赫斯基敦忽略了?“因此,LaTex包不能包含在index.Rmd文件的YAML头中。
下一篇论文模板包含文件"template.tex“,该文件定义了文档类,并提供了几个LaTex包。手动向此文件中添加huxtable所需的所有huxtable包可以解决以下问题:
%-------------------------------
% Huxtable
%-------------------------------
% load LaTex packages needed for huxtable
\usepackage{array}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{calc}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{wrapfig}https://stackoverflow.com/questions/57637596
复制相似问题