rstudio / rticles

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

Issue with Pandoc CSL refs and some articles templates #383

Closed cderv closed 3 years ago

cderv commented 3 years ago

Reported first in tinytex https://github.com/yihui/tinytex/issues/298

> dir.create(tmp_dir <- tempfile())
> owd <- setwd(tmp_dir)
> rmarkdown::draft("myArticle", template = "frontiers", package = "rticles", edit = FALSE)
> list.files("myArticle/")
> setwd("myArticle/")
> rmarkdown::render("myArticle.Rmd", quiet = TRUE)
! You can't use `\vadjust' in vertical mode.
l.300 \leavevmode\vadjust
                          pre{\hypertarget{ref-Neurobot2013}{}}% 

Error: LaTeX failed to compile myArticle.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See myArticle.log for more info.
> setwd(owd)
> unlink(tmp_dir, recursive = TRUE)

Error seems to be from Pandocs CSL references part

\begin{CSLReferences}{1}{0}
\leavevmode\vadjust pre{\hypertarget{ref-Neurobot2013}{}}%
Author4, N., and Author5, N. (2013). Title of the article.
\emph{Frontiers in Neurorobotics} 7.
doi:\href{https://doi.org/10.3389/fnbot.2013.56789}{10.3389/fnbot.2013.56789}.

\leavevmode\vadjust pre{\hypertarget{ref-Neuro2013}{}}%
LastName1, A., LastName2, A., and LastName2, A. (2013). Article title.
\emph{Frontiers in Neuroscience} 30, 10127--10134.
doi:\href{https://doi.org/10.3389/fnins.2013.12345}{10.3389/fnins.2013.12345}.

\leavevmode\vadjust pre{\hypertarget{ref-Gene2012}{}}%
OtherAuthor, N., and Coauthor, N. S. (2012). Article title.
\emph{Frontiers in Genetics} 30, 16417--16418.
doi:\href{https://doi.org/10.3389/fgene.2012.54321}{10.3389/fgene.2012.54321}.

\end{CSLReferences}

Same with elsevier template

rmarkdown::draft("myArticle", template = "elsevier", package = "rticles", edit = FALSE)
cderv commented 3 years ago

It seems new from Pandoc 2.13 as with previous version is work ok. (tested locally with 2.13 then 2.11.4)

I added a test for Pandoc devel to confirm:

IndrajeetPatil commented 3 years ago

Do the solutions/PRs related to this issue also fix the issue mentioned here? https://stackoverflow.com/questions/67004645/r-knitting-error-rticles-vadjust-in-vertical-mode

cderv commented 3 years ago

Possible. Did you try with dev version of rticles ?

Do not hesitate to open a new issue also if something seems wrong

cderv commented 3 years ago

I just checked and tested: yes #390 should have fixed your issue reported in SO. Frontier article compile without issue.

When you encountered such issue, do not hesitate to try dev version.

remotes::install_github("rstudio/rticles")
IndrajeetPatil commented 3 years ago

Thanks for the quick response, Christophe! I can confirm that the GitHub version indeed solves this problem.

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.