0

I tried to use the template in the rticles and I get the following error :

! LaTeX Error: Environment cslreferences undefined.

and that's no matter which template, I choose. When I look up the text file generated after running the code, I see the section that contained the article references has the same name "clsreferences". In changing that to the bibliography, the tex version was able to compile. I am trying to understand where the problem comes from and how to fix it so I can still use rmarkdown as I am too well versed in latex.

If I comment on the .bib file, the template is able to compile. So I imagine, this has to do with the way this rmd is translated to tex to be able to compile;

Any help will be useful.

Thanks in advance, Here is the last template I attempted

and here's the error it sent:

! LaTeX Error: Environment cslreferences undefined.

Execution halted
MLavoie
  • 9,671
  • 41
  • 36
  • 56
Billy
  • 1
  • 2
    Hi! Please format your post to make it easier to read. Also take a look at [how to ask a good, reproducible R question](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – mhovd Dec 05 '19 at 09:39
  • 1
    I cannot reproduce this. For me the template compiles and there is no trace of an `cslrefernces` environment. Which pandoc version and TeX system do you use? can you post the `pandoc` command-line that should be visible before the LaTeX error appears? – Ralf Stubner Dec 05 '19 at 09:51
  • /home/linuxbrew/.linuxbrew/bin/pandoc +RTS -K512m -RTS test10.utf8.md --to latex --from markdown+tex_math_single_backslash-autolink_bare_uris --output test10.tex --self-contained --template /home/bbauzile/R/x86_64-pc-linux-gnu-library/3.6/rticles/rmarkdown/templates/elsevier_article/resources/template.tex --highlight-style tango --pdf-engine pdflatex --lua-filter /home/bbauzile/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /home/bbauzile/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/lua/latex-div.lua --filter /home/linuxbrew/.linuxbrew/bin/pandoc-citeproc – Billy Dec 05 '19 at 11:52
  • Are you using pandoc version 2.8? See https://stackoverflow.com/questions/59193797/. – Ralf Stubner Dec 05 '19 at 13:19
  • @RalfStubner I am using *pandoc version 2.8.0.1* . Just tried and it did not solve it. – Billy Dec 05 '19 at 13:43
  • What did you try exactly? – Ralf Stubner Dec 05 '19 at 13:48
  • @RalfStubner. I created a file name with the code : --- \newlength{\cslhangindent} \setlength{\cslhangindent}{1.5em} \newenvironment{cslreferences}% {\setlength{\parindent}{0pt}% \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces}% {\par} --- and inserted it after the session like this: output: rticles::elsevier_article head-include: clreferences_silent.tex – Billy Dec 05 '19 at 14:28
  • 1
    I'm working on it: https://github.com/rstudio/rticles/issues/260 Meanwhile, if you are using RStudio, there is no need to install Pandoc separately---the current version of RStudio bundles a lower version of Pandoc, which won't create this problem. If you have to install Pandoc by yourself, you may install Pandoc before 2.8 before I fix the problem in rticles. – Yihui Xie Dec 05 '19 at 14:58
  • There is no `header-include` standard YAML header. And `header-includes` expects literal LaTeX code. Something like `header-includes: \input{clreferences_silent}` should work. – Ralf Stubner Dec 05 '19 at 15:13
  • @RalfStubner Thanks! Yes, that did it. Both template and a document that I am working on were able to compile. – Billy Dec 05 '19 at 19:31
  • @YihuiXie, I tried uninstall pandoc and compiling the template without the solution proposed by Ralf. And it still didn't compile. I am very grateful for the help and the work you guys are doing! – Billy Dec 05 '19 at 19:36
  • 1
    I have fixed https://github.com/rstudio/rticles/issues/260. Please try `remotes::install_github('rstudio/rticles')`. – Yihui Xie Dec 06 '19 at 05:32

0 Answers0