rjournal / rjtools

Tools for AUTHORS to use for checking and submitting articles to the R Journal
https://rjournal.github.io/rjtools/
Other
31 stars 14 forks source link

`zip_paper()` doesn't include HTML or PDF when operating in subdirectory #30

Closed ms609 closed 1 year ago

ms609 commented 2 years ago

I used create_article(file_name = "articleName", dir_path = "Article") to create an article in the "Article" subdirectory.

I was surprised to have an article returned for resubmission when the zip archive I constructed with zip_paper(name = "Article/articleName") didn't contain the necessary HTML & PDF files. On reinspection, I see that the contents of other subdirectories are also included in this zip: I see

  adding: Article/RJwrapper.log (deflated 79%)
  adding: Article/RJwrapper.pdf (deflated 25%)
  adding: Article/RJwrapper.tex (deflated 44%)
  adding: Template/RJwrapper.tex (deflated 55%)

Perhaps zip_paper also needs a dir_path parameter? Or if this is the intended behaviour, could a message be displayed to the user advising on what further steps must be taken?

As a workaround, I think it is possible to go:

setwd("Article")
zip_paper("articleName")

Then I see

  adding: articleName.bib (deflated 70%)
  adding: articleName.html (deflated 75%)
  adding: articleName.R (deflated 53%)
  adding: articleName.Rmd (deflated 60%)
  adding: articleName.tex (deflated 62%)
  adding: RJwrapper.log (deflated 77%)
  adding: RJwrapper.pdf (deflated 25%)
  adding: RJwrapper.tex (deflated 44%)

But this does not include the articleName_files directory to accompany articleName.html, meaning that the html page is not viewable (as its default body css style visibility:hidden is not removed).

Session info

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

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     

other attached packages:
[1] rjtools_1.0.0
huizezhang-sherry commented 2 years ago

Thanks for trying out this new function!

You will only need to supply the file name for the name argument in zip_paper() and in your case, it will be zip_paper("articleName"). This string will be used to match files in the directory and include them in the zip. The directory name is not needed.

I have just added some codes to include the articleName_file directory in the zip and this should make the html page viewable.

ms609 commented 2 years ago

rjtools::zip_paper("articleName") produces:

Removing created paper.zip and associated paper folder if detected.
  adding: Article/RJwrapper.log (deflated 76%)
  adding: Article/RJwrapper.pdf (deflated 25%)
  adding: Article/RJwrapper.tex (deflated 44%)

i.e. source files (articleName.bib, articleName.Rmd, etc) and HTML output are missing.

(I also wonder how this would handle a case where two separate sub-directories contain different articles named articleName.)

huizezhang-sherry commented 2 years ago

Is it possible to take a look at your repo?

articleName in zip_paper() should find all the files whose name contain articleName, which includes articleName.bib, articleName.Rmd.

ms609 commented 2 years ago

Thanks for offering to take a look. I've invited you as a collaborator to my private repo. Hopefully you can see what you need.

huizezhang-sherry commented 2 years ago

Thanks for sharing.

You will need to knit the Rmd file, which should create the following files and folder:

Then, rjtools::zip_paper() will generate a zip file with everything needed.

Also you may want to include CoverLetter.md and Figures as supplementary materials for your submission. These will need to be specified through the others argument as:

rjtools::zip_paper("smith", others = c("Figures", "CoverLetter.md"))

ms609 commented 2 years ago

Thanks – knitting the Rmd file does create these files (which omit from the repo with a .gitignore) but they are still not included in zip_paper().

I think I noticed that the create-article function in rjtools creates a motivation-letter.md file, which I modified in the repo – is CoverLetter.md in fact the preferred file name? I had assumed that zip_paper() would automatically include the files created by the article creation function.

huizezhang-sherry commented 2 years ago

With your repo, I can generate a zip that includes these files:

motivation-letter.md is now included in zip created by zip_paper(). We encourage users to directly modify this file for the cover letter and if a different name is used, you will have to explicitly specify it .

ms609 commented 2 years ago

I've just updated rjtools from github and run zip_paper("smith") again from the root directory. paper.zip does now include a .bib, .html, .R, .Rmd, and .tex file, but not smith_files. I have double-checked that the Article directory contains a smith_files subdirectory.

Could the difference between our outcomes reflect an operating system issue? (I'm on Windows 10.)

huizezhang-sherry commented 2 years ago

oh, this may be the reason. I just changed how file path is created and hopefully this now works for Windows, if this is still of your interest now.

dicook commented 2 years ago

@ms609 on your submission we also see that it is missing some of the pre-created figures, eg TreeSpace.png . You need to specifically include these file names when you run zip_paper().