如何在Rmarkdown pandoc正版参考中带回缩进解决方法?

时间:2017-10-13 22:15:45

标签: r latex rstudio pandoc

我正在使用RStudio的Rmarkdown和真正的pandoc引文。我还使用LaTeX编码的变通方法来缩进引用。直到RStudio版本1.0.153这个方法工作得很好。自最新版本1.1.383起,它不再起作用了。

这是我的代码:

application/pdf

bibliography.bib的内容:

---
title: Example
author: Author
output: pdf_document
bibliography: bibliography.bib
---
```{r setup, include=FALSE, tidy=TRUE}
library(knitr)
opts_chunk$set(echo = TRUE)
```
# Chapter
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy 
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam 
voluptua [@hawking_thermodynamics_1983]. At Einstein [-@einstein_ist_1905] 
vero eos et accusam et justo duo dolores et ea 
rebum.

# References
\vspace{-.55cm}
\setlength{\parindent}{-0.2in}
\setlength{\leftskip}{0.2in}
\setlength{\parskip}{8pt}
\noindent
<div id="refs"></div>
```{r refmgr references, results="asis", echo=FALSE}
# PrintBibliography(bib) 
```
\setlength{\parindent}{0in}
\setlength{\leftskip}{0in}
\setlength{\parskip}{0pt}

# Appendix
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
et dolore magna aliquyam erat, sed diam voluptua. 

RStudio v 1.0.153的前PDF结果: enter image description here

最新版RStudio v 1.1.383的PDF结果: enter image description here

正如您所看到的那样,@article{einstein_ist_1905, title = {Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?}, volume = {323}, url = {https://s3.amazonaws.com/objects.readcube.com/articles/downloaded/wiley/a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf?response-content-disposition=attachment%3B%20filename%3D%22Einstein-1905-Annalen_der_Physik.pdf%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIS5LBPCM5JPOCDGQ%2F20170830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170830T124037Z&X-Amz-Expires=127162&X-Amz-SignedHeaders=host&X-Amz-Signature=3de93a7b9a7edbcc0676232820c448641df14f4a22d339ad07a8cc06200d7632}, doi = {doi:10.1002/andp.19053231314}, pages = {639--641}, journaltitle = {Ann. Phys.}, author = {Einstein, Albert}, urldate = {2017-08-30}, date = {1905}, file = {a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf:C\:\\Users\\jay\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\dbkhbdqv.default\\zotero\\storage\\TTPHSMIX\\a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf:application/pdf} } @article{hawking_thermodynamics_1983, title = {Thermodynamics of black holes in anti-de Sitter space}, volume = {87}, issn = {0010-3616, 1432-0916}, url = {http://link.springer.com/10.1007/BF01208266}, doi = {10.1007/BF01208266}, pages = {577--588}, number = {4}, journaltitle = {Communications in Mathematical Physics}, author = {Hawking, S. W. and Page, Don N.}, urldate = {2017-10-13}, date = {1983-12}, langid = {english}, file = {57cae4b908ae3ac722b1eaa1.pdf:C\:\\Users\\jay\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\dbkhbdqv.default\\zotero\\storage\\DZ38DDCK\\57cae4b908ae3ac722b1eaa1.pdf:application/pdf} } 标签(用于让参考文献出现在附录之前)似乎无法识别。我无法从RStudio Release History找到任何东西。

有没有人知道我如何能够带回参考文献的缩进?

1 个答案:

答案 0 :(得分:1)

<div id="refs"></div>

之前和之后添加换行符
...
\noindent

<div id="refs"></div>

```{r refmgr references, results="asis", echo=FALSE}
...

enter image description here