How to move the bibliography in markdown/pandoc

时间秒杀一切 提交于 2019-12-08 16:21:24

问题


I'm currently writing my bachelor thesis and my instructor wants me to put my appendix after the bibliography but markdown/pandoc puts the references at the end by default. I read the instructions at http://yihui.name/knitr/demo/pandoc/ and tried to use the include-after-body=FILE command to put a separate .rmd file at the end of the document My code looks like this:

```{r, echo=FALSE, warning=FALSE, message=FALSE}
library(knitr)
pandoc('thesis.rmd', format="latex")
```

and for the options:

<!--pandoc
t: latex
include-after-body: appendix.rmd
o: output.pdf
-->

Where appendix.rmd is the separate appendix file.

After klicking on convert pdf, the process gets stuck with an error after the line executing pandoc --include-after-body=appendix.rmd -o thesis.pdf -f markdown -t latex -o thesis.pdf "thesis.utf8md"

The error is:

pandoc.exe: Error producing PDF from TeX source.

Is there something wrong with the code or is there some other method to remove the bibliography from the end of the document?


回答1:


There is another solution:

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

It lets you put the references wherever you want.




回答2:


You can place your bibliography wherever you like by inserting

::: {#refs}
:::

wherever you want the bibliography printed. From the citation section of the pandoc markdown manual.

For example:

...main body

# References

::: {#refs}
:::

# Appendix



回答3:


I just figured out that it works when you use a tex file, like --include-after-body=appendix.tex. I'm not an RMarkdown or Tex expert at all but I could imagine that it will only include the file after your main Rmd is already converted to a tex file using the default template.



来源:https://stackoverflow.com/questions/28815781/how-to-move-the-bibliography-in-markdown-pandoc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!