Reference section text has wrong line breaks

Hi,

I'm not sure the title is correct. Basically, there is a line break after each number in the list of references.

I link to this style https://www.zotero.org/styles?q=id%3Avancouver-brackets-only-year-no-issue via the YAML parameter citation-style:, and my output is bookdown::html_document2:

Can you reproduce this? Any ideas what might be wrong?

Here is a reproducible example:

---
title: "Untitled"
date: "`r Sys.Date()`"
output: html_document
bibliography: packages.bib
csl: https://www.zotero.org/styles/vancouver-brackets-only-year-no-issue
---

# A header

```{r setup, include=FALSE}
knitr::write_bib("knitr", "packages.bib")
```

See [@R-knitr]

# References

Can you share your pandoc version ?

rmarkdown::pandoc_version()

I cannot reproduce using Pandoc 2.7.3 but I can using Pandoc 2.11.2. It could be a pandoc issue.

1 Like

My apologies for my poor issue report. My pandoc version is 2.11.0.4

by this example you provided:

---
title: "Untitled"
date: "`r Sys.Date()`"
output: html_document
bibliography: packages.bib
csl: https://www.zotero.org/styles/vancouver-brackets-only-year-no-issue
---
  
  # A header
  
```{r setup, include=FALSE}
knitr::write_bib("knitr", "packages.bib")```

See [@R-knitr]

# References

I can reproduce the issue

Extra info:

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Manjaro Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.9.0
LAPACK: /usr/lib/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       ```

I think this is something related to pandoc change in 2.11 regarding references. They know use a new citeproc with new CSL handling. This seems to cause issue with the specific CSL style.

I would try to create an example using Pandoc only (no Rmarkdown) to see if I am right about this being a pandoc issue.

Also you should upgrade Pandoc to last version (2.11.2) .

1 Like

Ah thank you for letting me know, I opened a bug report here https://github.com/jgm/pandoc/issues/6882

After looking into this more in details, this is related to Pandoc changes in 2.11.2 but it is rmarkdown related as some CSS is required.

Try this as a workaround

---
title: "Untitled"
date: "`r Sys.Date()`"
output: html_document
bibliography: packages.bib
csl: https://www.zotero.org/styles/vancouver-brackets-only-year-no-issue
---

# A header

```{css, echo = FALSE}
div.csl-bib-body { }
div.csl-entry {
  clear: both;
$if(csl-entry-spacing)$
  margin-bottom: $csl-entry-spacing$;
$endif$
}
.hanging div.csl-entry {
  margin-left:2em;
  text-indent:-2em;
}
div.csl-left-margin {
  min-width:2em;
  float:left;
}
div.csl-right-inline {
  margin-left:2em;
  padding-left:1em;
}
div.csl-indent {
  margin-left: 2em;
}
```


```{r setup, include=FALSE}
knitr::write_bib("knitr", "packages.bib")
```

See [@R-knitr]

# References

I'll open an issue in Rmarkdown. Thanks a lot for the report about this !

1 Like

Reported in https://github.com/rstudio/rmarkdown/issues/1959

1 Like

This should be fixed now in dev version of Rmarkdown.

1 Like

Thank you very much!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.