Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_article() creates an article that does not render out of the box and that does not pass initial_check_article() #119

Open
HenrikBengtsson opened this issue Mar 12, 2024 · 0 comments

Comments

@HenrikBengtsson
Copy link

HenrikBengtsson commented Mar 12, 2024

I think create_article() should generate an article that compiles out of the box and that passes initial_check_article(). Currently, it does not. Here's the reproducible example:

> rjtools::create_article()
ℹ Please use the folder data/, figures/, scripts/ and
motivation-letter/ to organise additional data, figures, scripts,
and motivation letter.
! Please maintain the default file/folder structure as it will be checked
upon submission.
ℹ [Action required] Please align the file name between test.Rmd and
RJreferences.bib.
Success: your paper is ready to edit!

Comment: Couldn't create_article() automatically "align the file name between test.Rmd and RJreferences.bib" (whatever that means)?

Then, rendering this article:

rmarkdown::render("test.Rmd")


processing file: test.Rmd
  |.......                                    |  15% [setup]                   
Quitting from lines 36-41 [setup] (test.Rmd)
Error in library(plotly) : there is no package called 'plotly'

I think this is unnecessary friction for someone who's trying to write an RJ article for the first time. I argue that either all required packages should be installed together with the package, or the template article should not depend on them. BTW, 'plotly' has large number of package dependencies, so requiring a user to install all those in order to try out the template is a big ask, especially if the user installs packages from source.

Also, the user immediately ends up in a trial'n'error phase trying to get these packages installed;

> rmarkdown::render("test.Rmd")


processing file: test.Rmd
  |.......                                    |  15% [setup]                   
Quitting from lines 36-41 [setup] (test.Rmd)
Error in library(palmerpenguins) : 
  there is no package called 'palmerpenguins'
> rmarkdown::render("test.Rmd")


processing file: test.Rmd
  |.......                                    |  15% [setup]                   
Quitting from lines 36-41 [setup] (test.Rmd)
Error in library(kableExtra) : there is no package called 'kableExtra'

...

Eventually, the template article builds:

> rmarkdown::render("test.Rmd")


processing file: test.Rmd
                                                                                                                     
output file: test.knit.md

Detected the following packages from article:
  CRAN: ToOoOlTiPs, plotly, crosstalk, tsibbletalk, palmerpenguins, ggplot2
  Bioconductor: 
/home/henrik/shared/software/CBI/pandoc-3.1.9/bin/pandoc +RTS -K512m -RTS test.knit.md --to html5 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.html --lua-filter /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/rmarkdown/rmarkdown/lua/latex-div.lua --lua-filter /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/rjtools/latex-pkg.lua --lua-filter /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/rjtools/sec-depth.lua --embed-resources --standalone --wrap preserve --standalone --variable toc-float=1 --highlight-style /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/distill/rmarkdown/templates/distill_article/resources/arrow.theme --template /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/distill/rmarkdown/templates/distill_article/resources/default.html '--metadata=link-citations:true' --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1f49558c0ehtml --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1fe377df7html --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1f3e039173html --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1f32698f7chtml --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1f1aff6e67html --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1fca6251html --include-before-body /tmp/henrik/RtmpkvrRcE/filea0a1f3701d5ahtml --include-before-body /tmp/henrik/RtmpkvrRcE/filea0a1f4e3bab29html --include-before-body /tmp/henrik/RtmpkvrRcE/filea0a1f63bdf03ahtml --include-after-body /tmp/henrik/RtmpkvrRcE/filea0a1f5e16c1efhtml --include-after-body /tmp/henrik/RtmpkvrRcE/filea0a1f10188876html --include-after-body /tmp/henrik/RtmpkvrRcE/filea0a1f5e13608fhtml --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/henrik/RtmpkvrRcE/rmarkdown-stra0a1f5b2cf234.html --include-in-header /tmp/henrik/RtmpkvrRcE/filea0a1f7dc0c5fhtml --number-sections --include-in-header /home/henrik/R/ubuntu22_04-x86_64-pc-linux-gnu-library/4.3-CBI-gcc11-sandbox/rjtools/rjdistill.html --citeproc 

Output created: test.html
Error: 
! in callr subprocess.
Caused by error: 
! LaTeX failed to compile RJwrapper.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See RJwrapper.log for more info.See `$stdout` and `$stderr` for standard output and error.

Comment: I am on an up-to-date Ubuntu 22.04 running R 4.3.3 with up-to-date packages. I'm not sure if the above LaTeX error is only on my machine, or it happens to all users. Anyway, continuing with the checks ...

> rjtools::initial_check_article(".")

── Initial check results:  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ SUCCESS: Submission has consistently named tex, bib, and R files
! WARNING: The archive contains hidden files which will be removed: .RhistorySUCCESS: File and directory names are compliant.ERROR: Image(s) detected in the main directory: Rlogo-5.png. They should be placed in the figures/ folder.SUCCESS: No problematic file foundSUCCESS: Possible motivation letter found: motivation-letter, motivation-letter.pdfSUCCESS: Article title formatted in title case.SUCCESS: Section titles formatted in sentence case.SUCCESS: Abstract formatted in plain text.NOTE: A potential list of spelling to check: tooltips, tooltip
What's the name of the package being proposed in the article? Press Enter if none. 
✔ SUCCESS: No proposed package for the article, nothing to check.
✔ SUCCESS: No error with the use of \pkg markup.
✖ ERROR: 1 of 6 package(s) not available on CRAN: ToOoOlTiPs
✔ SUCCESS: All the references contain DOI or URL
Error in yaml::yaml.load(..., eval.expr = TRUE) : 
  Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 5, column 3

As you see, the example template article, produces two check ERRORs, one WARNING, and one NOTE. There is also a run-time error.

I think that the template article should produce all 'SUCCESS'.

In summary: It think a user/author should be able to run:

rjtools::create_article()
rmarkdown::render("test.Rmd")
rjtools::initial_check_article(".")

with zero hiccups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant