kableExtra functions in R return latex errors when compiling rmarkdown file to PDF document in Rstudio
up vote
0
down vote
favorite
I'm trying to knit a rmarkdown file to PDF file which contains kableExtra functions like:
- kable_styling
- column_spec
- add_header_above
However I am always getting the following error:
! Extra alignment tab has been changed to cr.
<template> endtemplate
l.184 end{tabular}}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
Ejecución interrumpida
One easy example that I am executing is:
```
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
- usepackage{xcolor}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped",
"bordered"))
%>%column_spec(column=1:2,width = "0.5in") %>%
kable_styling(c("striped", "bordered"),latex_options =
"scale_down")%>% add_header_above(c(" "=7,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,"Absolute"=1,
"Relative"=1))%>%
add_header_above(c(" "= 1,"Non-weighted"=1,"Weighted"=1,"Non-
weighted"=1,"Weighted"=1,"Non-weighted"=1,
"Weighted"=1,"Weighted"=2,"Non-weighted"=2,"Weighted"=2,"Non-
weighted"=2,"Weighted"=2))%>%
add_header_above(c("Theoretical Values"= 1,"First-Order Predicted
Value"=2,"Second-Order Predicted Value"=2,
"Third-Order Predicted Value"=2,
"Non-linearity 1st Order"=2,"Non-linearity 2nd Order"=4,"Non-linearity 3rd
Order"=4)))
```
Can anyone help me with this issue?
I would appreciate whatever clue!
r r-markdown kableextra
add a comment |
up vote
0
down vote
favorite
I'm trying to knit a rmarkdown file to PDF file which contains kableExtra functions like:
- kable_styling
- column_spec
- add_header_above
However I am always getting the following error:
! Extra alignment tab has been changed to cr.
<template> endtemplate
l.184 end{tabular}}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
Ejecución interrumpida
One easy example that I am executing is:
```
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
- usepackage{xcolor}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped",
"bordered"))
%>%column_spec(column=1:2,width = "0.5in") %>%
kable_styling(c("striped", "bordered"),latex_options =
"scale_down")%>% add_header_above(c(" "=7,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,"Absolute"=1,
"Relative"=1))%>%
add_header_above(c(" "= 1,"Non-weighted"=1,"Weighted"=1,"Non-
weighted"=1,"Weighted"=1,"Non-weighted"=1,
"Weighted"=1,"Weighted"=2,"Non-weighted"=2,"Weighted"=2,"Non-
weighted"=2,"Weighted"=2))%>%
add_header_above(c("Theoretical Values"= 1,"First-Order Predicted
Value"=2,"Second-Order Predicted Value"=2,
"Third-Order Predicted Value"=2,
"Non-linearity 1st Order"=2,"Non-linearity 2nd Order"=4,"Non-linearity 3rd
Order"=4)))
```
Can anyone help me with this issue?
I would appreciate whatever clue!
r r-markdown kableextra
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to knit a rmarkdown file to PDF file which contains kableExtra functions like:
- kable_styling
- column_spec
- add_header_above
However I am always getting the following error:
! Extra alignment tab has been changed to cr.
<template> endtemplate
l.184 end{tabular}}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
Ejecución interrumpida
One easy example that I am executing is:
```
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
- usepackage{xcolor}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped",
"bordered"))
%>%column_spec(column=1:2,width = "0.5in") %>%
kable_styling(c("striped", "bordered"),latex_options =
"scale_down")%>% add_header_above(c(" "=7,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,"Absolute"=1,
"Relative"=1))%>%
add_header_above(c(" "= 1,"Non-weighted"=1,"Weighted"=1,"Non-
weighted"=1,"Weighted"=1,"Non-weighted"=1,
"Weighted"=1,"Weighted"=2,"Non-weighted"=2,"Weighted"=2,"Non-
weighted"=2,"Weighted"=2))%>%
add_header_above(c("Theoretical Values"= 1,"First-Order Predicted
Value"=2,"Second-Order Predicted Value"=2,
"Third-Order Predicted Value"=2,
"Non-linearity 1st Order"=2,"Non-linearity 2nd Order"=4,"Non-linearity 3rd
Order"=4)))
```
Can anyone help me with this issue?
I would appreciate whatever clue!
r r-markdown kableextra
I'm trying to knit a rmarkdown file to PDF file which contains kableExtra functions like:
- kable_styling
- column_spec
- add_header_above
However I am always getting the following error:
! Extra alignment tab has been changed to cr.
<template> endtemplate
l.184 end{tabular}}
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
Ejecución interrumpida
One easy example that I am executing is:
```
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
- usepackage{xcolor}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped",
"bordered"))
%>%column_spec(column=1:2,width = "0.5in") %>%
kable_styling(c("striped", "bordered"),latex_options =
"scale_down")%>% add_header_above(c(" "=7,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,
"Absolute"=1,"Relative"=1,"Absolute"=1,"Relative"=1,"Absolute"=1,
"Relative"=1))%>%
add_header_above(c(" "= 1,"Non-weighted"=1,"Weighted"=1,"Non-
weighted"=1,"Weighted"=1,"Non-weighted"=1,
"Weighted"=1,"Weighted"=2,"Non-weighted"=2,"Weighted"=2,"Non-
weighted"=2,"Weighted"=2))%>%
add_header_above(c("Theoretical Values"= 1,"First-Order Predicted
Value"=2,"Second-Order Predicted Value"=2,
"Third-Order Predicted Value"=2,
"Non-linearity 1st Order"=2,"Non-linearity 2nd Order"=4,"Non-linearity 3rd
Order"=4)))
```
Can anyone help me with this issue?
I would appreciate whatever clue!
r r-markdown kableextra
r r-markdown kableextra
edited Nov 23 at 10:37
asked Nov 22 at 15:46
Laura Santulario Verdú
13
13
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You are telling kableExtra
not to load the LaTeX packages (why?), so you have to do this yourself. The features you are using require array
, float
and xcolor
with the table
option. One difficulty is that fancyvrb
v3.0 already loads xcolor
with other options. You can circumvent this by supplying table
as a class option:
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex") %>%column_spec(column=1:2,width = "0.5in"))
```
```{r results='asis'}
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
```
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
|
show 7 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You are telling kableExtra
not to load the LaTeX packages (why?), so you have to do this yourself. The features you are using require array
, float
and xcolor
with the table
option. One difficulty is that fancyvrb
v3.0 already loads xcolor
with other options. You can circumvent this by supplying table
as a class option:
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex") %>%column_spec(column=1:2,width = "0.5in"))
```
```{r results='asis'}
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
```
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
|
show 7 more comments
up vote
1
down vote
You are telling kableExtra
not to load the LaTeX packages (why?), so you have to do this yourself. The features you are using require array
, float
and xcolor
with the table
option. One difficulty is that fancyvrb
v3.0 already loads xcolor
with other options. You can circumvent this by supplying table
as a class option:
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex") %>%column_spec(column=1:2,width = "0.5in"))
```
```{r results='asis'}
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
```
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
|
show 7 more comments
up vote
1
down vote
up vote
1
down vote
You are telling kableExtra
not to load the LaTeX packages (why?), so you have to do this yourself. The features you are using require array
, float
and xcolor
with the table
option. One difficulty is that fancyvrb
v3.0 already loads xcolor
with other options. You can circumvent this by supplying table
as a class option:
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex") %>%column_spec(column=1:2,width = "0.5in"))
```
```{r results='asis'}
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
```
You are telling kableExtra
not to load the LaTeX packages (why?), so you have to do this yourself. The features you are using require array
, float
and xcolor
with the table
option. One difficulty is that fancyvrb
v3.0 already loads xcolor
with other options. You can circumvent this by supplying table
as a class option:
---
output:
pdf_document:
keep_tex: yes
classoption: table
header-includes:
- usepackage{array}
- usepackage{float}
---
```{r results='asis'}
options(kableExtra.latex.load_packages = FALSE)
require(kableExtra)
print(kable(head(cars),"latex") %>%column_spec(column=1:2,width = "0.5in"))
```
```{r results='asis'}
print(kable(head(cars),"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
```
edited Nov 23 at 9:43
answered Nov 22 at 16:15
Ralf Stubner
13.6k21437
13.6k21437
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
|
show 7 more comments
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
@LauraSantularioVerdú Please edit your question to include such information.
– Ralf Stubner
Nov 23 at 6:53
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---
{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
Thank you very much for your help. It is true that I 'd forgotten the YALM so I 've added now. The thing is that it is that now it works for function column_spec() but not for kable_styling(). I write you the code I have problems with: --- output: pdf_document header-includes: - usepackage{array} ---
{r results='asis'} options(kableExtra.latex.load_packages = FALSE) require(kableExtra) print(kable(cars,"latex")%>%kable_styling(latex_options = c("striped", "bordered")))
– Laura Santulario Verdú
Nov 23 at 8:56
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
What error(s) do you get? Please add code to your question, since it is unreadable in a comment. Also please build a Minimal, Complete, and Verifiable example instead of including code and the full YAML header separately.
– Ralf Stubner
Nov 23 at 9:27
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
Sorry, I have updated right now
– Laura Santulario Verdú
Nov 23 at 10:04
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
@LauraSantularioVerdú Thanks, please see my updated answer.
– Ralf Stubner
Nov 23 at 10:06
|
show 7 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434402%2fkableextra-functions-in-r-return-latex-errors-when-compiling-rmarkdown-file-to-p%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown