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

LaTeX Error: Environment cslreferences undefined #7

Open
CarolineXGao opened this issue Oct 18, 2020 · 4 comments
Open

LaTeX Error: Environment cslreferences undefined #7

CarolineXGao opened this issue Oct 18, 2020 · 4 comments

Comments

@CarolineXGao
Copy link

Hi Rob,

Thanks for the templets. I have been trying to find a nice template for paper submission and find rticles templets quite hard to manually edit anything. Your template works beautifully. One problem that I found with the WorkingPaper template when using under bookdown (with additional csl specification), is that it seems to report an error of cslreferences. Adding this code in the template seems to be able to fix the problem. Although I am not sure why : )

$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{cslreferences}%
  {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  {\par}
$endif$

Thanks again for sharing ~~

Best,
Caroline

@robjhyndman
Copy link
Owner

Please provide a minimal reproducible example that gives this error. I use the template regularly and I have not seen it.

@CarolineXGao
Copy link
Author

Hi Rob,

Here is my Markdown document specification:

---
title: "Very important anlaysis"
author: 
- familyname: Gao
  othernames: Caroline X.
  address: Centre for Youth Mental Health, University of Melbourne
  qualifications:  PhD
output:
   bookdown::pdf_document2:
     toc: no
     number_sections: false
     pandoc_args:
      - --csl=plos-medicine.csl
      - --template=monashwp.tex
abstract: "To be added" 
date: "`r format(Sys.time(), '%B %d, %Y')`"                
geometry: margin=1in
fontsize: 11pt
bibliography: references.bib 
---

When any citation is used, there is an error message:

! LaTeX Error: Environment cslreferences undefined.

My R environment:

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6
loaded via a namespace (and not attached):
[1] httr_1.4.2 viridisLite_0.3.0 splines_4.0.2 tmvnsim_1.0-2
[5] here_0.1 gtools_3.8.2 Formula_1.2-3 BDgraph_2.63
[9] stats4_4.0.2 latticeExtra_0.6-29 yaml_2.2.1 d3Network_0.5.2.1
[13] pbivnorm_0.6.0 pillar_1.4.6 backports_1.1.10 lattice_0.20-41
[17] glue_1.4.2 digest_0.6.25 RColorBrewer_1.1-2 checkmate_2.0.0
[21] rvest_0.3.6 colorspace_1.4-1 htmltools_0.5.0 Matrix_1.2-18
[25] plyr_1.8.6 psych_2.0.8 pkgconfig_2.0.3 bookdown_0.20
[29] purrr_0.3.4 corpcor_1.6.9 webshot_0.5.2 scales_1.1.1
[33] glasso_1.11 whisker_0.4 jpeg_0.1-8.1 fdrtool_1.2.15
[37] huge_1.3.4.1 htmlTable_2.1.0 tibble_3.0.3 rticles_0.16
[41] generics_0.0.2 ggplot2_3.3.2 ellipsis_0.3.1 pbapply_1.4-3
[45] nnet_7.3-14 mnormt_2.0.2 survival_3.1-12 magrittr_1.5
[49] crayon_1.3.4 evaluate_0.14 nlme_3.1-148 MASS_7.3-51.6
[53] xml2_1.3.2 foreign_0.8-80 tools_4.0.2 data.table_1.13.0
[57] lifecycle_0.2.0 stringr_1.4.0 munsell_0.5.0 cluster_2.1.0
[61] kableExtra_1.2.1 compiler_4.0.2 rlang_0.4.7 grid_4.0.2
[65] rstudioapi_0.11 rjson_0.2.20 htmlwidgets_1.5.1 igraph_1.2.5
[69] lavaan_0.6-7 base64enc_0.1-3 rmarkdown_2.3 gtable_0.3.0
[73] abind_1.4-5 reshape2_1.4.4 qgraph_1.6.5 R6_2.4.1
[77] gridExtra_2.3 knitr_1.30 dplyr_1.0.2 Hmisc_4.4-1
[81] rprojroot_1.3-2 stringi_1.5.3 parallel_4.0.2 Rcpp_1.0.5
[85] vctrs_0.3.4 rpart_4.1-15 png_0.1-7 tidyselect_1.1.0
[89] xfun_0.18

Thanks!!

Caroline

@robjhyndman
Copy link
Owner

The template uses biblatex for referencing, not csl. You can edit the template to remove the biblatex specs, or you can use a biblatex style for PLOS. There are some suggestions here: https://tex.stackexchange.com/a/52586/143

@CarolineXGao
Copy link
Author

Thanks Rob!!

I think when using the template under bookdown, bookdown calls csl. By including the cslreferences specification, somehow it over-writes the biblatex style. I found myself had to use bookdown because I have used figure citation style @ref(fig: figure1), so it works with both word and latex under bookdown. I am still quite new to this, so not sure whether it is the best way to go. But it seems working now.

Thanks for your help, much appreciated : )

Best,

Caroline

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

2 participants