Open JVAQUEROM opened 5 years ago
That is definitely a reasonable feature request.
I would like to provide some custom function to deal with this.
It definetively needs a lot of improvements. I am not really a developer so, please excuse me. If someone can improve my function to make it better it would be delighted!
getsources(){
require(utils)
source.files <- list.files(path = c("style", "_bookdown_files", "bib", "images"), full.names = TRUE)
source.tex <- list.files("_book/", pattern = ".tex", full.names = TRUE)
zip("sources.zip", c(source.tex, source.files))
}
Before compiling you have to extract the zip and move the .tex file from _book/ to the root folder of the zip. For some reasons I cannot underestand, the bibtex citations are not working, but this probably has an easy fix
Hi, so after some time I have been taking a look to the source code of pdf_book()
(latex.R
file). I think that after the call to tinytex::latexmk()
there could be a line like if(!is.null(zipfile)) zip(zipfile=zipfile, files=list.files("."))
. zipfile
should be a new argument set by default to NULL and to the name of the zipfile if you want to get the latex sources.
I tried implementing this but it didn't work. Actually, I am unable to download the zipfille of this repo and locally install de package. I download and then:
install.packages("~/bookdown-main_old.zip", repos=NULL, type="source")
Installing package into '<libfolder>/4.1'
(as 'lib' is unspecified)
Error in rawToChar(block[seq_len(ns)]) :
nul incrustado en la cadena: 'PK\003\004\n\0\0\0\0\0:\025ZS\0\0\0\0\0\0\0\0\0\
0\0\0\016\0\t\0bookdown-main/UT\005\0\001`\xcdwaPK\003\004\n\0\0\0\b\0:\025ZS\xe
5\x9d5o\xb8\0\0\0\034\001\0\0\033\0\t\0bookdown-main/.Rb' "
Warning message:
In install.packages("~/bookdown-main_old.zip", repos = NULL) :
installation of package '/home/javier/bookdown-main_old.zip' had non-zero exit status
So being able to build the package would help me testing the implementation I suggest.
Thank you!
Hi @JVAQUEROM,
I you want to contribute to the project, best thing is to use GIT ? Do you already use Git ?
You could then clone the bookdown project (using RStudio IDE for example), then create a branch and work from that branch to modify your code.
BTW usethis can help you through the all process once you are setup (https://usethis.r-lib.org/articles/articles/usethis-setup.html)
create_from_github
. It will fork the bookdonw github repo to your user, clone in git and setup the remote for youusethis::pr_init("latex-source")
for example. If you want to test your change, you can use RStudio IDE to install your modified version or use devtools::load_all()
on your package project, before a call to render_book()
and your test book.
Hope it helps. Happy to help further is need.
Hello,
Bookdown is a great tool for writing academic papers. Still, there is something that I believe it would be a very useful feature and (I believe) it is not implemented. I would be an option to make bookdown create a zip file with all the sources inside. When you submit a paper to an academic journal, you usually need to provide the LaTex sources. However, in bookdown, files are a bit "untidy". I mean, the tex file seems to be compiled in the working directory, then moved to _book folder, and so on. So you cannot just compile it because LaTeX would not find the files.
So I think that and option to create a new "sources" folder or a "sources.zip" file would be awesome.
Thank you!