Closed JoseBSL closed 3 years ago
Hi @JoseBSL ,
does this chapter provide what you need? https://ulyngs.github.io/oxforddown/tables.html :)
Ulrik
Thanks Ulrik! That is indeed a superuseful resource!
I'm not sure what happens but I'm still unable to run the code that I posted (which runs fine in markdown) in bookdown. I guess it may be a latex thing or KableExtra related (I have reinstall tex and KableExtra for mac and still got the same issue).
Ok just made it, I needed to add to the template ociamthesis.cls
\usepackage{booktabs} \usepackage{longtable} \usepackage{array} \usepackage{multirow} \usepackage{wrapfig} \usepackage{float} \usepackage{colortbl} \usepackage{pdflscape} \usepackage{tabu} \usepackage{threeparttable} \usepackage{threeparttablex} \usepackage[normalem]{ulem} \usepackage{makecell} \usepackage{xcolor}
as recommended in http://haozhu233.github.io/kableExtra/awesome_table_in_pdf.pdf
Seems that was not loading the kableExtra packages properly (don't know why).
Sorry for the trouble and thanks a lot for the help!
Hi Jose,
I think the current version should be fixed so that the kableExtra packages are included whenever you load the kableExtra library somewhere - can you test if it works for you in the current version without needed to add anything to ociamthesis.cls?
I jus tried and without that packages I was not able to build the document. It might be other latex expression that I'm using to format the tables that requires one of these packages. I'm running it with KableExtra version 1.3.4
I get this error when I do not add these packages to ociamthesis.cls:
[pandoc warning] Could not parse YAML header: mapping values are not allowed in this context "source" (line 159, column 25) ! LaTeX Error: Environment longtabu undefined.
interesting - I assume it works for you also if you add these packages in templates/template.tex instead of in ociamthesis.cls?
Sounds like I should just revert to putting the packages explicitly in the template instead of being clever about it!
Yes, you are right, it also works if I add the same list of packages in the section of your own personal macros of template.tex
Jose, just to be sure, did you try downloading a fresh copy of the current oxforddown on GitHub and try? I think it should work for you without adding the packages, as long as you do library(kableExtra)
somewhere?
(if it still doesn't, then i'll add the kableExtra packages back in explicitly)
Ha! This is getting tricky Ulrik (a new problem came up), I just downloaded the latest oxforwdon but I cannot build (I haven't added my documents on it yet).
Execution halted make: *** [pdf] Error 1
is this the error message you're getting:
make: Rscript: No such file or directory
make: *** [pdf] Error 1
Does it compile as normal when you simply knit index.Rmd?
The index.Rmd does not compile either, I'm getting this error when I build all:
output file: _main.knit.md
pandoc: unrecognized option `--lua-filter=scripts_and_filters/colour_and_highlight.lua'
Try pandoc --help for more information.
Error: pandoc document conversion failed with error 2
In addition: Warning messages:
1: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
2: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
3: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
Execution halted
make: *** [pdf] Error 1
Exited with status 2.
try not 'build all' but simply knit index.Rmd - what happens then?
(also, which operating system are you on? I am guessing mac os with big sur, as this has caused me similar trouble)
Yes, I'm on Mac too, macOS Mojave Version 10.14.6, maybe time to update?
Yes when iI knit just index.Rmd I also get a similar error. The weird thing is that I don't get it for the bookdown project that I'm working with.
output file: _main.knit.md
pandoc: unrecognized option `--lua-filter=scripts_and_filters/colour_and_highlight.lua'
Try pandoc --help for more information.
Error: pandoc document conversion failed with error 2
In addition: Warning messages:
1: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
2: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
3: In yaml::yaml.load(..., eval.expr = TRUE) :
NAs introduced by coercion: 10,052 is not an integer
Execution halted
strange - what happens if you remove the lua-filter option, given the error message?
Yep, that works!
ok, it's not obvious to me why that happens.
Back to the topic of this issue: in the current version, can you confirm that you are able to use kableExtra by simply loading the kableExtra library and not needing to add additional latex packages explicitly?
I confimed it Ulrik, no need to add extra packages with the most updated version of oxfordown, kableExtra works fine by just loading the library :)
Do I miss new things if I keep working with the "old one"?
I just flagged the current version as a release and documented the changes here: https://github.com/ulyngs/oxforddown/releases/tag/3.0
I have not been able to format tables as I do in markdown. Is there another way to format tables and control their sizes?
Here is an example of a table that I'm formatting using kableExtra, I'm not very familiar with bookdown so I may be missing something relevant, I do apologize if that's the case.
This table in markdown runs well with this YAML
output: pdf_document: keep_tex: yes fig_caption: yes toc: no html_document: toc: no df_print: paged fontsize: 12pt header-includes:
\usepackage{caption}
However, in bookdown I'm unable to run it with the kable_styling specifications. Sorry if this is not an issue!