Closed HenrikBengtsson closed 1 year ago
Hi @HenrikBengtsson Thanks for this feedback. Some of this is easy to fix, and we'll make the changes asap.
It took me a couple of hours to figure out how to adjust my RStudio setup so that it'll render quokka-bilby.Rmd
.
Your document has a callout (\RequirePackage{tikz}
) which causes a fatal error in my Latex compilation (using tinytex). I can't find tikz.sty
anywhere in my Win11 filesystem. A search on the internet revealed that it is something that miktex would have in its pgf package.
About my setup: I had installed RStudio less than a year ago, using tinytex rather than miktex as per the advice of section 1.2 of the RMarkdown Cookbook: "... we recommend that R Markdown users install TinyTeX.".
I gave tinytex a nudge with a manual invocation of tinytex::parse_install("RJwrapper.log")
, but it was clueless:
tlmgr search --file --global "/tikz.sty"
Warning message:
In parse_packages(...) : Failed to find a package that contains tikz.sty
My resolution:
tlmgr_search('tikz.sty')
throws an error due to a stale version of Tex Live; tlmgr_update()
; tlmgr_search('tikz.sty')
now finds tikz.sty
in CTAN, hooray!rmarkdown::render("quokka-bilby.Rmd")
, and wait very very patiently for tinytex to run into fatal error after fatal error, loading one .sty file each time. I'd suggest ... that you revise your Create a Journal Article vignette to advise the folks who are using tinytex rather than miktex to perform steps 1, 2, 4 in the list above before attempting to do their first rendering of your sample article. Also I think some warning about being patient is important, as there is no diagnostic output visible in RStudio (at least in my setup) while tinytex is grinding away. (Viewing the current contents of RJwrapper.log
in an RStudio edit pane will lock the file and prevent a new logfile from being created when tinytex attempts to recover from its previous fatal error.)
Alternatively... you might work toward providing a template which doesn't rely on style files that are part of miktex but not part of tinytex. That said... it's nice to have an example with such bells-and-whistles!
BTW I'm nowhere near wizardly enough in RStudio to figure out how to persuade my installation to use miktex rather than tinytex, otherwise I would have given this a go -- despite the advice in the RMarkdown Cookbook. I'm guessing there's a setup file somewhere on my system that isn't affected by unticking the "Use tinytex when compiling tex files" in Global options for SWeave. Well ... I'm not going to worry about that, I'll stick with tinytex... now that I have managed to persuade it to compile my first rjournal_web_article
I can move on to authoring one ;-)
And: thanks for your work on rjtools. It looks like a nice package!
Hi Clark,
Tinytex is the recommendation. The .tex file should be generated even if it doesn’t complete the compile inside RStudio, which would mean that you can latex it outside, if absolutely necessary. On tikz, are you using this to create a figure? It should not be called. What operating system are you working on?
On 2 Apr 2023, at 4:44 pm, Clark Thomborson @.***> wrote:
I'm trying (and so far failing) to figure out how to adjust my RStudio setup so that it'll render quokka-bilby.Rmd.
The offending command is \RequirePackage{tikz}. I can't find tikz.sty anywhere in my Win11 filesystem -- it's apparently something that miktex would have in its pgf package.
I had installed RStudio less than a year ago, using tinytex rather than miktex as per the advice of section 1.2 of the RMarkdown Cookbook: "... we recommend that R Markdown users install TinyTeX.".
I'm getting the impression I'll have more joy with rjtools if I shift to miktex... but then again that could be a hiding to nowhere becuz in section 1.2 of https://bookdown.org/yihui/rmarkdown-cookbook/install-latex.html: "we recommend that R Markdown users install TinyTeX.".
I gave tinytex a nudge with a manual invocation of tinytex::parse_install("RJwrapper.log"), but it was clueless:
tlmgr search --file --global "/tikz.sty" Warning message: In parse_packages(...) : Failed to find a package that contains tikz.sty
My resolution:
• install miktex, following steps 5 and 6 in the [recipe provided by someone at Reed College](https://www.reed.edu/data-at-reed/software/R/r_studio_pc.html • open the miktex console, click on its "Check for updates" affordance, wait until all updates are complete, then test the installation using step 8 of the Reed College recipe • notice that a manual invocation of tlmgr_search('tikz.sty') throws an error due to a stale version of Tex Live; • run tlmgr_update(); • notice that tlmgr_search('tikz.sty') now finds tikz.sty in CTAN, hooray! • run rmarkdown::render("quokka-bilby.Rmd"), and wait very very patiently for tinytex to run into fatal error after fatal error, loading one .sty file each time. I'd suggest ... that you revise your Create a Journal Article vignette to advise the folks who are using tinytex rather than miktex to perform steps 1, 2, 4 in the list above before attempting to do their first rendering of your sample article. Also I think some warning about being patient is important, as there is no diagnostic output visible in RStudio (at least in my setup) while tinytex is grinding away. (Viewing the current contents of RJwrapper.log in an RStudio edit pane will lock the file and prevent a new logfile from being created when tinytex attempts to recover from its previous fatal error.)
Alternatively... you might work toward providing a template which doesn't rely on style files that are part of miktex but not part of tinytex. That said... it's nice to have an example with such bells-and-whistles!
BTW I'm nowhere near wizardly enough in RStudio to figure out how to persuade my installation to use miktex rather than tinytex, otherwise I would have given this a go -- despite the advice in the RMarkdown Cookbook. I'm guessing there's a setup file somewhere on my system that isn't affected by unticking the "Use tinytex when compiling tex files" in Global options for SWeave. Well ... I'm not going to worry about that, I'll stick with tinytex... now that I have managed to persuade it to compile my first rjournal_web_article I can move on to authoring one ;-)
And: thanks for your work on rjtools. It looks like a nice package!
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
cheers, Di
Dianne Cook @.***
Hi Di, thanks for responding. This is my very first experience with rjtools. I was using the example article provided with that package. This article calls out for rjournal.sty. The version of rjournal.sty
that was loaded by my (very recently-installed) version of rjtools::create_article()
contains a callout to tikx.sty
. Perhaps there's a versioning problem somewhere? IMHO it's quite hazardous to expect all versions of a latex style file to be forward and backward compatible.... suggesting to me that ... it might save a lot of time (for both users and rjtool maintainers) if all style files required to compile the quokka-bilby.Rmd were loaded into the project directory by rjtools::create_article()
I'm glad to know that you're recommending tinytex for rjtools. The (embedded) callout to tikx.sty made me think that there might be some other miktex dependencies... and I'm now thinking that there's probably no need to install miktex at all, given that tinytex is so diligent about digging through CTAN to find style files.
BTW latex has bugger-all in the way of support for version control, so variant versions of style files -- and the many versions of latex itself -- can cause great difficulties when compiling someone else's latex, or for that matter when compiling latex you authored yourself at some future date, unless you're careful to keep copies of all of the style files you used when compiling. I note that R Journal expects authors to include their style files with a submission. Possibly the dependency on tikx.sty is a weak point in its production processes?
I think you mean tikz.sty. This would be because some legacy latex papers use tikz for figures. When the style was purely latex there were some very strict rules on what an author could do, for the reasons you describe, it was a nightmare for us to compile the papers for each issue.
You didn’t tell me what operating system you are using. It might help to provide the sessionInfo also.
On 3 Apr 2023, at 8:00 am, Clark Thomborson @.***> wrote:
Hi Di, thanks for responding. This is my very first experience with rjtools. I was using the example article provided with that package. This article calls out for rjournal.sty. The version of rjournal.sty that was loaded by my (very recently-installed) version of rjtools::create_article() contains a callout to tikx.sty. Perhaps there's a versioning problem somewhere? IMHO it's quite hazardous to expect all versions of a latex style file to be forward and backward compatible.... suggesting to me that ... it might save a lot of time (for both users and rjtool maintainers) if all style files required to compile the quokka-bilby.Rmd were loaded into the project directory by rjtools::create_article()
I'm glad to know that you're recommending tinytex for rjtools. The (embedded) callout to tikx.sty made me think that there might be some other miktex dependencies... and I'm now thinking that there's probably no need to install miktex at all, given that tinytex is so diligent about digging through CTAN to find style files.
BTW latex has bugger-all in the way of support for version control, so variant versions of style files -- and the many versions of latex itself -- can cause great difficulties when compiling someone else's latex, or for that matter when compiling latex you authored yourself at some future date, unless you're careful to keep copies of all of the style files you used when compiling. I note that R Journal expects authors to include their style files with a submission. Possibly the dependency on tikx.sty is a weak point in its production processes?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
cheers, Di
Dianne Cook @.***
Oh you're right, it's tikz.sty. The callout in RJournal.sty is \RequirePackage{tikz}
. Apologies.
https://tex.stackexchange.com/questions/9518/how-to-specify-latex-style-file-precedence-when-multiple-versions-might-exist suggests that the working directory is searched first for .sty files, in a typical LaTeX installation. That's my experience as well.
But! Tikz is a very special package in miktex, according to https://comp.text.tex.narkive.com/TEjcuqxT/sty-files-in-subdirectory it "... uses its own interpreter for libraries". Apparently this interpreter doesn't look in the "/sty" subdirectory of its working directory... which is where I usually put the style files when collaborating with co-authors, back in the days when I was actively doing this...
All to say that I'd expect style-file versioning to create some ongoing "fun" for rjtool users and devs!
Here's my OS and session info.
Edition Windows 11 Pro Version 22H2 Installed on 21/09/2022 OS build 22621.1413 Serial number YX03F6BD Experience Windows Feature Experience Pack 1000.22639.1000.0
sessioninfo::session_info() ─ Session info ──────────────────────────────────────────────────────────────────────── setting value version R version 4.2.3 (2023-03-15 ucrt) os Windows 10 x64 (build 22621) system x86_64, mingw32 ui RStudio language (EN) collate English_New Zealand.utf8 ctype English_New Zealand.utf8 tz Pacific/Auckland date 2023-04-03 rstudio 2023.03.0+386 Cherry Blossom (desktop) pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
─ Packages ──────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3) colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.3) digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.3) fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.3) glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.1) htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.2.3) httr 1.4.5 2023-02-24 [1] CRAN (R 4.2.3) kableExtra 1.3.4 2021-02-20 [1] CRAN (R 4.2.3) knitr 1.42 2023-01-25 [1] CRAN (R 4.2.3) lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.1) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.1) R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.1) rlang 1.1.0 2023-03-14 [1] CRAN (R 4.2.3) rmarkdown 2.21 2023-03-26 [1] CRAN (R 4.2.3) rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1) rvest 1.0.3 2022-08-19 [1] CRAN (R 4.2.2) scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1) stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2) stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2) svglite 2.1.1 2023-01-10 [1] CRAN (R 4.2.3) systemfonts 1.0.4 2022-02-11 [1] CRAN (R 4.2.1) viridisLite 0.4.1 2022-08-22 [1] CRAN (R 4.2.1) webshot 0.5.4 2022-09-26 [1] CRAN (R 4.2.3) xfun 0.38 2023-03-24 [1] CRAN (R 4.2.3) xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.1) yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.3)
[1] C:/Users/cthom/AppData/Local/R/win-library/4.2 [2] C:/Program Files/R/R-4.2.3/library
───────────────────────────────────────────────────────────────────────────────────────
Thanks!
On 3 Apr 2023, at 8:21 am, Clark Thomborson @.***> wrote:
Here's my OS and session info.
Edition Windows 11 Pro Version 22H2 Installed on 21/09/2022 OS build 22621.1413 Serial number YX03F6BD Experience Windows Feature Experience Pack 1000.22639.1000.0
sessioninfo::session_info() ─ Session info ──────────────────────────────────────────────────────────────────────── setting value version R version 4.2.3 (2023-03-15 ucrt) os Windows 10 x64 (build 22621) system x86_64, mingw32 ui RStudio language (EN) collate English_New Zealand.utf8 ctype English_New Zealand.utf8 tz Pacific/Auckland date 2023-04-03 rstudio 2023.03.0+386 Cherry Blossom (desktop) pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
─ Packages ──────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3) colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.3) digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.3) fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.3) glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.1) htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.2.3) httr 1.4.5 2023-02-24 [1] CRAN (R 4.2.3) kableExtra 1.3.4 2021-02-20 [1] CRAN (R 4.2.3) knitr 1.42 2023-01-25 [1] CRAN (R 4.2.3) lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.1) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.1) R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.1) rlang 1.1.0 2023-03-14 [1] CRAN (R 4.2.3) rmarkdown 2.21 2023-03-26 [1] CRAN (R 4.2.3) rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1) rvest 1.0.3 2022-08-19 [1] CRAN (R 4.2.2) scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1) stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2) stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2) svglite 2.1.1 2023-01-10 [1] CRAN (R 4.2.3) systemfonts 1.0.4 2022-02-11 [1] CRAN (R 4.2.1) viridisLite 0.4.1 2022-08-22 [1] CRAN (R 4.2.1) webshot 0.5.4 2022-09-26 [1] CRAN (R 4.2.3) xfun 0.38 2023-03-24 [1] CRAN (R 4.2.3) xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.1) yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.3)
[1] C:/Users/cthom/AppData/Local/R/win-library/4.2 [2] C:/Program Files/R/R-4.2.3/library
───────────────────────────────────────────────────────────────────────────────────────
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
cheers, Di
Dianne Cook @.***
@cthombor Can you tell me if the html file is created? If so, this will be sufficient for a submission.
I just tested with someone on Windows, and they had no problems. So I suspect it is related to your tex installation. It would be good to know if a .tex file is created on your system.
Yes I did manage to create a .tex file. The pdf looks good.
The problem was indeed with my tex installation, which is why I suggested you adjust your vignette to inform people that they'll get no joy from rjtools if their tex installation is stale. (That was step 4 in my defect-resolution.)
I'm now almost certain that a miktex installation isn't required (that was my steps 1 & 2).
I still think it'd be a good idea to adjust your vignette so that it warns people that their first compilation of quokka-bilby.Rmd may take a long time, and there'll be no console output while tinytex is hitting fatal error after fatal error (making a step of forward progress each time by loading just one of the required .sty files).
I also think it'd be a good idea to adjust your template so that it is self-contained i.e. so that it is not reliant on importing .sty files from CTAN (not only because that's slow, but also because there's always a risk that some later version of these .sty files will not be backward-compatible with your template). Alternatively I suppose you could warn rjtool users of the possibility that they might encounter a version-incompatibility, how they could recognise this (e.g. by diffing the pdf they generate with some reference version), and what they should do if this happens.
Ok, noted.
All issues mentioned in this issue are fixed now - I hope I've followed the thread sufficiently
I still get:
> rmarkdown::render("test.Rmd")
...
Quitting from lines 35-40 [setup] (test.Rmd)
Error in library(kableExtra) : there is no package called 'kableExtra'
after using rjtools::create_article()
. This is with:
> packageVersion("rjtools")
[1] '1.0.12'
TL;DR
The instructions on https://rjournal.github.io/rjtools/ are incomplete and results in several errors when tried in a fresh R setup.
I think there's room for improving the instructions, which will lower the friction that a newcomer might experience. This is especially true if they are new to Rmarkdown, e.g. they've worked their whole life with LaTeX and might even have submitted articles to the R Journal using the LaTeX templates in the past.
Details
Here is what user who starts out with a fresh R installation, and who doesn't use RStudio, will see when they follow the official instructions. We assume the user installs rjtools from CRAN using:
or they may also install from GitHub.
Next, following the 'Getting started with a new article' instructions on https://rjournal.github.io/rjtools/, they call:
Hmm ...?!? It requires to read
?create_article
, or get to the third vignette https://rjournal.github.io/rjtools/articles/create_article.html), to get past this. Retrying with:That worked. Continuing on to the 'Your first knit' section. The instructions there says:
Let's cut'n'paste that as-is:
Okay, it could have been that
create_article()
would have created the files in a subfolderpaper/
, but from the error message I guess it's just a generic placeholder. Lets retry withoutpaper/
:Righty-oh. At least it's now start processing the Rmd file, but clearly, I'm missing the plotly package. So let's install that:
After installing that, we try again:
Hmmm... keep on pushing:
and retrying:
So another type of error now. This doesn't look my typical R error. It's complaining about "pandoc". I wonder if there's an issue with my Pandoc installation (I happens to know what Pandoc is). Oh wait ... "there is no package called 'kableExtra'". Let's try by installing that first:
Crossing my fingers it'll work this time:
Uff! There's still that Pandoc error.
Now we're getting into operating-system specific instructions, which is always tricky. Nevertheless, I'm on Ubuntu 22.04, and I've installed Pandoc using:
However, I was unaware of
pandoc-citeproc
, but trying to call it from the terminal:gives me cut'n'pastable instructions for installing it. After calling:
and retrying in R:
Success!