rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.46k stars 516 forks source link

Unable to knit the joss_article template #389

Closed llrs closed 3 years ago

llrs commented 3 years ago

Many thanks for providing templates for journals! Quite useful as I had created my own version of .Rmd for a submission.

I just installed rticles from CRAN for an article in JOSS. However, using the template for rticles::joss_article without touching anything I get an error:

1: In citation_package_arg(citation_package) :
  citation_package = 'none' was deprecated; please use 'default' instead.
2: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  error in running command
Execution halted

The error seems to be on: https://github.com/rstudio/rticles/blob/3340e40084f4bb7c9a336e3943afc90bb7741d7a/R/joss_article.R#L34

Also noted that this format is not tested on test/testit/test-formats.R

Session info ``` ─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 3.6.3 (2020-02-29) os Ubuntu 20.04.2 LTS system x86_64, linux-gnu ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz Europe/Madrid date 2021-04-21 ─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date lib source audio 0.1-7 2020-03-09 [1] CRAN (R 3.6.3) beepr * 1.3 2018-06-04 [1] CRAN (R 3.6.0) cachem 1.0.4 2021-02-13 [1] CRAN (R 3.6.3) callr 3.6.0 2021-03-28 [1] CRAN (R 3.6.3) cli 2.4.0 2021-04-05 [1] CRAN (R 3.6.3) covr * 3.5.1 2020-09-16 [1] CRAN (R 3.6.3) crayon 1.4.1 2021-02-08 [1] CRAN (R 3.6.3) cyclocomp * 1.1.0 2016-09-10 [1] CRAN (R 3.6.0) desc 1.3.0 2021-03-05 [1] CRAN (R 3.6.3) devtools * 2.4.0 2021-04-07 [1] CRAN (R 3.6.3) digest 0.6.27 2020-10-24 [1] CRAN (R 3.6.3) ellipsis 0.3.1 2020-05-15 [1] CRAN (R 3.6.3) evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0) fastmap 1.1.0 2021-01-25 [1] CRAN (R 3.6.3) fs 1.5.0 2020-07-31 [1] CRAN (R 3.6.3) glue 1.4.2 2020-08-27 [1] CRAN (R 3.6.3) htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 3.6.3) knitr 1.32 2021-04-14 [1] CRAN (R 3.6.3) lazyeval 0.2.2 2019-03-15 [1] CRAN (R 3.6.0) lifecycle 1.0.0 2021-02-15 [1] CRAN (R 3.6.3) magrittr 2.0.1 2020-11-17 [1] CRAN (R 3.6.3) memoise 2.0.0 2021-01-26 [1] CRAN (R 3.6.3) pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 3.6.3) pkgload 1.2.1 2021-04-06 [1] CRAN (R 3.6.3) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.2) processx 3.5.1 2021-04-04 [1] CRAN (R 3.6.3) ps 1.6.0 2021-02-28 [1] CRAN (R 3.6.3) purrr 0.3.4 2020-04-17 [1] CRAN (R 3.6.3) R6 2.5.0 2020-10-28 [1] CRAN (R 3.6.3) rdoc * 0.1.0 2019-05-16 [1] CRAN (R 3.6.0) remotes 2.3.0 2021-04-01 [1] CRAN (R 3.6.3) rex 1.2.0 2020-04-21 [1] CRAN (R 3.6.3) rlang 0.4.10 2020-12-30 [1] CRAN (R 3.6.3) rmarkdown 2.7 2021-02-19 [1] CRAN (R 3.6.3) rprojroot 2.0.2 2020-11-15 [1] CRAN (R 3.6.3) rticles 0.19 2021-03-04 [1] CRAN (R 3.6.3) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0) stringi 1.5.3 2020-09-09 [1] CRAN (R 3.6.3) stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0) testthat * 3.0.2 2021-02-14 [1] CRAN (R 3.6.3) usethis * 2.0.1 2021-02-10 [1] CRAN (R 3.6.3) withr 2.4.2 2021-04-18 [1] CRAN (R 3.6.3) xfun 0.22 2021-03-11 [1] CRAN (R 3.6.3) yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.2) [1] /home/lrevilla/R/x86_64-pc-linux-gnu-library/3.6 [2] /usr/local/lib/R/site-library [3] /usr/lib/R/site-library [4] /usr/lib/R/library ```
cderv commented 3 years ago

Thanks @llrs !

I pushed a fix to remove the warning.

About the system2() error, I can't reproduce with the default template. I don't know where it comes from. Do you have a traceback for this error ?

Also noted that this format is not tested on test/testit/test-formats.R

It is tested here: https://github.com/rstudio/rticles/blob/e894ed5f44caeef4a333fedaef4a5df7e60884d6/tests/testit/test-formats.R#L51

llrs commented 3 years ago

Sorry my mistake. This might not be related to rticles and I also missed the joss reference on the file.

When I click the Knitr button I see this:

processing file: Untitled.Rmd
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code

/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS Untitled.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Untitled.tex --lua-filter /home/lrevilla/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/lrevilla/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --template /home/lrevilla/R/x86_64-pc-linux-gnu-library/3.6/rticles/rmarkdown/templates/joss/resources/template.tex --highlight-style tango --pdf-engine pdflatex -V logo_path=/home/lrevilla/R/x86_64-pc-linux-gnu-library/3.6/rticles/rmarkdown/templates/joss/resources/JOSS-logo.png -V 'journal_name=Journal of Open Source Software' -V graphics=true --citeproc 
output file: Untitled.knit.md

! LaTeX Error: File `biblatex.sty' not found.

! Emergency stop.
<read *> 

Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
In addition: Warning message:
In citation_package_arg(citation_package) :
  citation_package = 'none' was deprecated; please use 'default' instead.
Execution halted

However if I use

knitr::knitr("Untitled/Untitled.Rmd") the untitled.md (joss article) file can be created without errors.

I had to install texlive-xetex texlive-bibtex-extra biber and then the knitr button on rstudio worked! Thanks!!

cderv commented 3 years ago

I had to install texlive-xetex texlive-bibtex-extra biber and then the knitr button on rstudio worked! Thanks!!

Oh it seems you are using texlive so tinytex should have installed the missing packages automatically. Unless your user don't have writing right to the directory.

When you have this type of error ! LaTeX Error: Filebiblatex.sty' not found.`, you can find the missing package using

> tinytex::parse_packages(text = "! LaTeX Error: File `biblatex.sty' not found.")
tlmgr search --file --global "/biblatex.sty"
[1] "biblatex"

or

> tinytex::parse_packages(file= "biblatex.sty")
tlmgr search --file --global "/biblatex.sty"
[1] "biblatex

Then with TeX Live and tinytex, you can install with tinytex::tlmgr_install(). Note that tinytex::parse_install will do both: detection then installation.

llrs commented 3 years ago

I tried with tinytex::parse_packages but I got the following message:

tlmgr search --file --global '/biblatex.sty'
TLPDB: not a directory, not loading: /home/lrevilla/texmf
tlmgr: running in usermode, did you call `tlmgr init-usertree'?
Warning messages:
1: In system2("tlmgr", args, ...) :
  running command ''tlmgr' search --file --global '/biblatex.sty'' had status 2
2: In parse_packages(...) :
  Failed to find a package that contains biblatex.sty

After calling tlmgr init-usertree on a different terminal (not Rstudio terminal):

tlmgr search --file --global '/biblatex.sty'

/usr/bin/tlmgr: unexpected return value from verify_checksum: -5
Warning messages:
1: In system2("tlmgr", args, ...) :
  running command ''tlmgr' search --file --global '/biblatex.sty'' had status 1
2: In parse_packages(...) :
  Failed to find a package that contains biblatex.sty

Anyway thanks for the support and the quick fix of the warning

cderv commented 3 years ago

Ok I guess it does not work the same on all texlive installation. You may be using your system installation and not a user enabled one.

It works great with TinyteX distribution though if your are interested : https://tinytex.yihui.org/

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.