ismayc / thesisdown

An updated R Markdown thesis template using the bookdown package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chapter rendered in gitbook, not in pdf

matanmazor opened this issue · comments

commented

To add a fourth chapter to my thesis, I simply created '04-chap4.Rmd' and placed it in the index directory. (I also pushed forward the numbers for appendix and conclusion). This chapter is rendered in gitbook, but ignored in pdf. Should I edit some other file to make it work in both?

Thanks!

That behavior is unexpected. Can you share a reproducible example? Including session info can help diagnose too.

commented

I tried to reproduce it in a simple new project and it didn't happen there. I then copied the original project (all the files) into the directory of this new project and knitted, and everything worked okay in this new copy of the project. Strangely, now the original copy won't render the thesis at all, giving the following error message:

error in file(con, "r") cannot open the connection Calls: ... withVisible -> eval -> eval -> paste -> readLines - file

This sometimes happened in other Rmarkdown projects and I had to migrate the project to a different file/location.

Thanks again!

Session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 rstudioapi_0.11 knitr_1.28 magrittr_1.5
[5] tidyselect_1.1.0 lattice_0.20-38 R6_2.4.1 rlang_0.4.10
[9] blob_1.2.1 dplyr_1.0.4 tools_3.6.0 grid_3.6.0
[13] nlme_3.1-139 broom_0.5.6 xfun_0.21 DBI_1.1.0
[17] htmltools_0.5.1.1 ellipsis_0.3.1 remotes_2.2.0 yaml_2.2.1
[21] digest_0.6.27 assertthat_0.2.1 tibble_3.0.1 lifecycle_0.2.0
[25] bookdown_0.21 crayon_1.3.4 tidyr_1.1.0 purrr_0.3.4
[29] vctrs_0.3.6 glue_1.4.1 evaluate_0.14 rmarkdown_2.6
[33] compiler_3.6.0 pillar_1.4.4 backports_1.1.7 generics_0.0.2
[37] thesisdown_0.1.0 pkgconfig_2.0.3

commented

My #150 issue is also solved in the new copy directory . This seems to be a more general issue with Rmarkdown perhaps.

Did you happen to have a _bookdown.yml file? The specific Rmd files can be added there via the rmd_files parameter for each output format.

commented

I have a _bookdown.yml file, its content is:

book_filename: "thesis"
chapter_name: "Chapter "
download: [
["thesis.pdf", "PDF"],
["thesis.epub", "EPUB"],
["thesis.docx", "Word"]
]
delete_merged_file: true

What I find strange is that I'm getting different error messages/errors in rendering for the same project when copying the contents of the index directory to different directories. I tried to create a reproducible example but I'm not sure what it would consist of, given that it is not even reproducible on my own machine... I don't think however this problem is specific to thesisdown. I wonder if this is a more general issue with bookdown/rmarkdown. Are there perhaps hidden files that are generated in the process of rendering and that won't get copied if I copy the contents of a folder? I'm sorry if this deviates too much from the purpose of opening an issue here.

I don't think there are any hidden files beyond pandoc and LaTeX installations. Maybe try it out on rstudio.cloud or a different computer if possible?

commented

Hi Chester,

Sorry for taking me time with this. I have tried different things and I found that the issue is resolved when I delete the '_book' and '_bookdown_files' directories before knitting. In case someone ever reports a similar issue.

Many thanks for all your help,
-Matan

Ah! I'm going to open this issue up again so I can look into adding in cleaning of thesis directories, which will likely help others too. Thanks, @matanmazor!